0
votes

I am making an installer which includes several projects. My setup installs several components and DLLs.

My requirement for a custom action has only one execution to be done after installation has been successfully completed. The problem is that my executable depends upon a DLL which is included in the MSI package.

The Custom Action is as follows :-

<InstallExecuteSequence>
  <Custom Action='LaunchFile' After='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>
<CustomAction Id='LaunchFile' FileKey='Migration_and_SQL_Utility.exe' ExeCommand="configurationmanager" Return="asyncNoWait" Impersonate="no" />

I have also tried tweaking this and also read a lot of documentation and solution but still I can't understand why my application won't run.

When launched anytime Before=InstallFinalize or After=InstallFiles, it will always show me a JIT compiler error for the DLL dependency. And when After=InstallFinalize then it just won't execute my exe at all. I have also tried putting in other variables with different configuration such as Execute=deferred and Return=check but they give me different errors such as following from Event Viewer :-

Product: EasyReports -- Error 1721. There is a problem with this Windows Installer package. A program required for this install to complete could not be run. Contact your support personnel or package vendor. Action: LaunchFile, location: C:\Program Files (x86)\EasyReports\EasyReports\Migration and SQL Utility.exe, command: configurationmanager

Is there something that I do not understand about Wix Installer or something that I am missing out on. I am fairly new to WiX but I have made a successfully running setup for another project and with the same Custom Action to execute the executable after the installation has been completed and it was working just fine.

1
Is this a .NET file? Does it depend on anything in the GAC? When you copy all files in place manually and launch the EXE manually from the installed location, does it run OK?Stein Åsmul
Note that running custom actions after InstallFinalize means they do not run elevated. In other words they will not run with write access on the system in question if it is a managed system with a standard user logged in whilst the install is being run (for example when distributing MSI files via Active Directory).Stein Åsmul

1 Answers

0
votes

My solution would be:

Add Migration and SQL Utility.exe to your components:

<Component Id="Migration and SQL Utility.exe" Guid="SOME GUID">
    <File Id="Migration and SQL Utility.exe" Source="YOUR SOURCE" KeyPath="yes" Checksum="yes"/>
</Component>

Next define your custom action:

<CustomAction Id="LaunchFile"                  
          Execute="immediate" 
          Impersonate="no"
          Return="asyncNoWait"
          FileKey="Migration and SQL Utility.exe"
          ExeCommand="" />

Call the action:

<InstallExecuteSequence>
   <Custom Action='LaunchFile' After='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>