views:

128

answers:

2

I'm trying to deploy and run an application (C# console app) at the beginning of the MSI install with WIX but having some difficulty.

The application needs to run before any of the webserver actions happen but after the files have been copied from the MSI to the target location.

I can get the app to run but only if I have actually copied the application in the directory before I run the MSI. If I don't do that, I get an error relating to the app not existing in the MSI logs. So basically I think it has to do with the launch sequence I am using I need to ensure that the app exists before it is run.

Wondering if one of you good folks could help me out.

The requirement is that the application must run as the first thing the WIX MSI does, (well actually before any of the webservice parts happen).

The relevant bits of the Wix are as follows.

    <CustomAction Id='LaunchUpdaterRunFirst' FileKey='serverUpdaterRunFirstExe' ExeCommand='' Return='ignore' />

...

    <InstallExecuteSequence>
       <Custom Action='CA_BlockOlderVersionInstall' After='FindRelatedProducts'>NEWERVERSIONDETECTED</Custom>
       <RemoveExistingProducts After="InstallInitialize" />
       <Custom Action='LaunchUpdaterRunFirst' After='InstallInitialize' />
       <Custom Action='LaunchInstaller' After='InstallFinalize'><![CDATA[ REMOVE <> "ALL" and  UILevel <> 2]]></Custom>
    </InstallExecuteSequence>

...

     <Component Id="ServerInstaller" DiskId="1" Guid="9662EC72-1774-4d22-9F41-AD98A5DCD729">
        <File Id="serverUpdaterRunFirstExe" Name="MyCompany.Server.Updater.RunFirst.exe" Source="$(var.SOURCEPATH)\MyCompany.Server.Updater.RunFirst.exe" />
        <File Id="serverUpdaterRunFirstExeConfig" Name="MyCompany.Server.Updater.RunFirst.exe.config" Source="$(var.SOURCEPATH)\MyCompany.Server.Updater.RunFirst.exe.config" />

Any help or references greatly appreciated.

A: 

Instead of adding the executable file to the list of files to be installed try entering it as a Binary file ie

<Product ......>

  <Binary Id="serverUpdaterRunFirstExe" SourceFile="$(var.SOURCEPATH)\MyCompany.Server.Updater.RunFirst.exe" />

  <CustomAction Id="LaunchUpdaterRunFirst" BinaryKey="serverUpdaterRunFirstExe" />

</Product>
Charles Gargent
this probably does not work because the MyCompany.Server.Updater.RunFirst.exe.config file is missing.
Wimmel
A: 

See the WiX InstallExecuteSequence. You currently use

<Custom Action='LaunchUpdaterRunFirst' After='InstallInitialize' />

But at that moment the files are not copied yet. So I think you must use one of the following:

<Custom Action='LaunchUpdaterRunFirst' After='InstallFiles' />
<Custom Action='LaunchUpdaterRunFirst' Before='ConfigureIIs' />
Wimmel