简体   繁体   中英

Wix Installer Custom Action

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.

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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM