Writing Custom Action in Wix (Bundle)

0

I have a bundle of two MSIs where one of the MSI needs to copy files from disk(installer directory) to target. The custom action is written in C#. The Bundle builds fine and creates the exe. But When I try to install it, I get an error "0x80070643 - Fatal error during installation.". Looking at the logs, I see this error logs ...

>  [0640:13E0][TimeStamp]e000: Error 0x80070643: Failed to install MSI package.
>  [0640:13E0][TimeStamp]e000: Error 0x80070643: Failed to execute MSI package.
>  [141C:0DD4][TimeStamp]e000: Error 0x80070643: Failed to configure per-machine MSI     package.
...

And in my .wxs file for Sample2.msi, I have ...

<Binary Id="CopyFilesAction" SourceFile="..\..\Release\MyCustomAction.CA.dll" />
<CustomAction Id="CopyDiskFiles" BinaryKey="CopyFilesAction" DllEntry="CopyDiskFilesAction" Execute="immediate" Return="check" />

<InstallExecuteSequence>
  <Custom Action="CopyDiskFiles" Before="InstallFinalize" />            
</InstallExecuteSequence>

....

and the C# custom action looks like,

namespace MyCA
{
  public class TestApp
    {
        [CustomAction]
        public static ActionResult CopyDiskFilesAction(Session session)
        {
            try
            {               
                string file = "Read me.txt";
                string sourceDir = session["SETUPEXEDIR"]; //SETUPEXEDIR      //SourceDir
                string installDir = session["INSTALLDIR"];

                if (File.Exists((Path.Combine(sourceDir, file))))
                {
                    File.Copy(Path.Combine(sourceDir, file),         Path.Combine(installDir, file), true);                 
                }               
            }
            catch (Exception)
            {
                return ActionResult.Failure;
            }

            return ActionResult.Success;
        }
    }
}

Here is the whole trace logging:

>[14D0:0E78][TS]i001: Burn v3.7.1224.0, Windows v6.1 (Build 7601: Service Pack 1), path:     >D:\Source\ABC\BuildArtifacts\Installer\MyBundle.exe, cmdline: '-burn.unelevated BurnPipe.    >{5EF92470-E632-47DC-9E11-482A05E00748} {10DC3C00-CD2D-4475-A00C-90A9E3D8AE5D} 2796'
>[14D0:0E78][TS]i000: Initializing string variable 'InstallFolder' to value     >'[ProgramFilesFolder]ABCD\'
>[14D0:0E78][TS]i000: Initializing string variable 'InstallFolder2' to value     >'[WindowsVolume]ABCD\'
>[14D0:0E78][TS]i000: Setting string variable 'WixBundleLog' to value     >'C:\Users\USER1~1.EFG\AppData\Local\Temp\ABCDEF_20140218173420.log'
>[14D0:0E78][TS]i000: Setting string variable 'WixBundleOriginalSource' to value     >'D:\Source\ABC\BuildArtifacts\Installer\ABCDEF.exe'
>[14D0:0E78][TS]i000: Setting string variable 'WixBundleName' to value 'ABCDEF'
>[14D0:0E78][TS]i100: Detect begin, 2 packages
>[14D0:0E78][TS]i101: Detected package: Sample2.msi, state: Absent, cached: None
>[14D0:0E78][TS]i101: Detected package: Setup, state: Absent, cached: None
>[14D0:0E78][TS]i199: Detect complete, result: 0x0
>[14D0:329C][TS]i000: Setting numeric variable 'EulaAcceptCheckbox' to value 1
>[14D0:0E78][TS]i200: Plan begin, 2 packages, action: Install
>[14D0:0E78][TS]i000: Setting string variable 'WixBundleRollbackLog_Sample2.msi' to     >value     >'C:\Users\USER1~1.EFG\AppData\Local\Temp\ABCDEF_20140218173420_0_Sample2.msi_rollback.log'
>[14D0:0E78][TS]i000: Setting string variable 'WixBundleLog_Sample2.msi' to value     >'C:\Users\USER1~1.EFG\AppData\Local\Temp\ABCDEF_20140218173420_0_Sample2.msi.log'
>[14D0:0E78][TS]i000: Setting string variable 'WixBundleRollbackLog_Setup' to value     >'C:\Users\USER1~1.EFG\AppData\Local\Temp\ABCDEF_20140218173420_1_Setup_rollback.log'
>[14D0:0E78][TS]i000: Setting string variable 'WixBundleLog_Setup' to value     >'C:\Users\USER1~1.EFG\AppData\Local\Temp\ABCDEF_20140218173420_1_Setup.log'
>[14D0:0E78][TS]i201: Planned package: Sample2.msi, state: Absent, default requested:     >Present, ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache:     >No, dependency: Register
>[14D0:0E78][TS]i201: Planned package: Setup, state: Absent, default requested: Present,     >ba requested: Present, execute: Install, rollback: Uninstall, cache: Yes, uncache: No,     >dependency: Register
>[14D0:0E78][TS]i299: Plan complete, result: 0x0
>[14D0:0E78][TS]i300: Apply begin
>[0AEC:0980][TS]i000: Caching bundle from: 'C:\Users\USER1~1.EFG\AppData\Local\Temp\    >{GUID}\.be\ABCDEF.exe' to: 'C:\ProgramData\Package Cache\{GUID}\ABCDEF.exe'
>[0AEC:0980][TS]i320: Registering bundle dependency provider: {GUID}, version: 0.5.0.0
>[0AEC:026C][TS]i305: Verified acquired payload: Sample2.msi at path:     >C:\ProgramData\Package Cache\.unverified\Sample2.msi, moving to: C:\ProgramData\Package     >Cache\{55B1CFF4-A620-4A93-957F-1FE72A5F12E0}v3.2.846.0\Sample2.msi.
>[0AEC:026C][TS]i305: Verified acquired payload: Setup at path: C:\ProgramData\Package     >Cache\.unverified\Setup, moving to: C:\ProgramData\Package Cache\    >{GUID}v0.5.0.0\ABCDEF_Standalone.msi.
>[0AEC:026C][TS]i305: Verified acquired payload: f196699D08E79FB7EFC1A2D8AD29BD56F at     >path: C:\ProgramData\Package Cache\.unverified\f196699D08E79FB7EFC1A2D8AD29BD56F, moving     >to: C:\ProgramData\Package Cache\{GUID}v0.5.0.0\PFiles\ABCD\ABCDEF\ABCDEF Text1.txt.
>[0AEC:026C][TS]i305: Verified acquired payload: fE9DE1A6A8366231950181982D4565C1E at     >path: C:\ProgramData\Package Cache\.unverified\fE9DE1A6A8366231950181982D4565C1E, moving     >to: C:\ProgramData\Package Cache\{GUID}v0.5.0.0\PFiles\ABCD\ABCDEF\ABCDEF Text2.txt.
>[0AEC:026C][TS]i305: Verified acquired payload: f2F54C7BEFF6CBBBD79154610C4108101 at     >path: C:\ProgramData\Package Cache\.unverified\f2F54C7BEFF6CBBBD79154610C4108101, moving     >to: C:\ProgramData\Package Cache\{GUID}v0.5.0.0\PFiles\ABCD\ABCDEF\ABCDEF Text3.txt.
>[0AEC:026C][TS]i305: Verified acquired payload: fED2A2B9E0F5E346B4A4FD28554B8E6D9 at     >path: C:\ProgramData\Package Cache\.unverified\fED2A2B9E0F5E346B4A4FD28554B8E6D9, moving     >to: C:\ProgramData\Package Cache\{GUID}v0.5.0.0\PFiles\ABCD\ABCDEF\ABCDEF Text4.txt.
>[0AEC:0980][TS]i323: Registering package dependency provider: {55B1CFF4-A620-4A93-957F-    >1FE72A5F12E0}, version: 3.2.846.0, package: Sample2.msi
>[0AEC:0980][TS]i301: Applying execute package: Sample2.msi, action: Install, path:     >C:\ProgramData\Package Cache\{55B1CFF4-A620-4A93-957F-1FE72A5F12E0}v3.2.846.0\Sample2.msi,     >arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
>[14D0:0E78][TS]i319: Applied execute package: Sample2.msi, result: 0x0, restart: None
>[0AEC:0980][TS]i325: Registering dependency: {GUID} on package provider: {55B1CFF4-    >A620-4A93-957F-1FE72A5F12E0}, package: Sample2.msi
>[0AEC:0980][TS]i323: Registering package dependency provider: {GUID}, version: 0.5.0.0,     >package: Setup
>[0AEC:0980][TS]i301: Applying execute package: Setup, action: Install, path:     >C:\ProgramData\Package Cache\{GUID}v0.5.0.0\ABCDEF_Standalone.msi, arguments: '     >ALLUSERS="1" ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7" INSTALLDIR="C:\Program Files     >(x86)\ABCD\\ABCDEF" ABCD_DATA_DIRS="C:\ABCD\"'
>[0AEC:0980][TS]e000: Error 0x80070643: Failed to install MSI package.
>[0AEC:0980][TS]e000: Error 0x80070643: Failed to execute MSI package.
>[14D0:0E78][TS]e000: Error 0x80070643: Failed to configure per-machine MSI package.
>[14D0:0E78][TS]i319: Applied execute package: Setup, result: 0x80070643, restart: None
>[14D0:0E78][TS]e000: Error 0x80070643: Failed to execute MSI package.
>[0AEC:0980][TS]i318: Skipped rollback of package: Setup, action: Uninstall, already:     >Absent
>[14D0:0E78][TS]i319: Applied rollback package: Setup, result: 0x0, restart: None
>[0AEC:0980][TS]i329: Removed package dependency provider: {GUID}, package: Setup
>[0AEC:0980][TS]i351: Removing cached package: Setup, from path: C:\ProgramData\Package     >Cache\{GUID}v0.5.0.0\
>[0AEC:0980][TS]i326: Removed dependency: {GUID} on package provider: {55B1CFF4-A620-    >4A93-957F-1FE72A5F12E0}, package Sample2.msi
>[0AEC:0980][TS]i301: Applying rollback package: Sample2.msi, action: Uninstall, path:     >C:\ProgramData\Package Cache\{55B1CFF4-A620-4A93-957F-1FE72A5F12E0}v3.2.846.0\Sample2.msi,     >arguments: ' ARPSYSTEMCOMPONENT="1" MSIFASTINSTALL="7"'
>[14D0:0E78][TS]i319: Applied rollback package: Sample2.msi, result: 0x0, restart: None
>[0AEC:0980][TS]i329: Removed package dependency provider: {55B1CFF4-A620-4A93-957F-    >1FE72A5F12E0}, package: Sample2.msi
>[0AEC:0980][TS]i351: Removing cached package: Sample2.msi, from path:     >C:\ProgramData\Package Cache\{55B1CFF4-A620-4A93-957F-1FE72A5F12E0}v3.2.846.0\
>[0AEC:0980][TS]i330: Removed bundle dependency provider: {GUID}
>[0AEC:0980][TS]i352: Removing cached bundle: {GUID}, from path: C:\ProgramData\Package     >Cache\{GUID}\
>[14D0:0E78][TS]i399: Apply complete, result: 0x80070643, restart: None, ba requested     >restart:  No
>[14D0:0E78][TS]i500: Shutting down, exit code: 0x643    
>[14D0:0E78][TS]i410: Variable: EulaAcceptCheckbox = 1
>[14D0:0E78][TS]i410: Variable: InstallFolder = C:\Program Files (x86)\ABCD\
>[14D0:0E78][TS]i410: Variable: InstallFolder2 = C:\ABCD\
>[14D0:0E78][TS]i410: Variable: ProgramFilesFolder = C:\Program Files (x86)\
>[14D0:0E78][TS]i410: Variable: WindowsVolume = C:\    
>[14D0:0E78][TS]i410: Variable: WixBundleAction = 4
>[14D0:0E78][TS]i410: Variable: WixBundleElevated = 1
>[14D0:0E78][TS]i410: Variable: WixBundleInstalled = 0
>[14D0:0E78][TS]i410: Variable: WixBundleLog =     >C:\Users\USER1~1.EFG\AppData\Local\Temp\ABCDEF_20140218173420.log
>[14D0:0E78][TS]i410: Variable: WixBundleLog_Sample2.msi =     >C:\Users\USER1~1.EFG\AppData\Local\Temp\ABCDEF_20140218173420_0_Sample2.msi.log
>[14D0:0E78][TS]i410: Variable: WixBundleLog_Setup =     >C:\Users\USER1~1.EFG\AppData\Local\Temp\ABCDEF_20140218173420_1_Setup.log
>[14D0:0E78][TS]i410: Variable: WixBundleManufacturer = ABCD
>[14D0:0E78][TS]i410: Variable: WixBundleName = ABCDEF
>[14D0:0E78][TS]i410: Variable: WixBundleOriginalSource =     >D:\Source\ABC\BuildArtifacts\Installer\ABCDEF.exe
>[14D0:0E78][TS]i410: Variable: WixBundleProviderKey = {GUID}
>[14D0:0E78][TS]i410: Variable: WixBundleRollbackLog_Sample2.msi =     >C:\Users\USER1~1.EFG\AppData\Local\Temp\ABCDEF_20140218173420_0_Sample2.msi_rollback.log
>[14D0:0E78][TS]i410: Variable: WixBundleRollbackLog_Setup =     >C:\Users\USER1~1.EFG\AppData\Local\Temp\ABCDEF_20140218173420_1_Setup_rollback.log    
>[14D0:0E78][TS]i410: Variable: WixBundleTag = 
>[14D0:0E78][TS]i410: Variable: WixBundleVersion = 0.5.0.0
>[14D0:0E78][TS]i007: Exit code: 0x643, restarting: No

Am I missing something? Thank you in advance for your comments!

c#
wix
custom-action
burn
wix3.7
asked on Stack Overflow Feb 19, 2014 by binyame tiruneh • edited Dec 22, 2015 by Yan Sklyarenko

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0