Start application after installation

2020-02-26 23:22发布

问题:

I've googled around and found some topics like

http://wix.sourceforge.net/manual-wix3/run_program_after_install.htm

and

Launch application after installation complete, with UAC turned on

but, i don't use any ui. Just simple installation! So far

<CustomAction Id="LaunchApp" Directory="INSTALLDIR" ExeCommand="[SystemFolder]cmd.exe /C MyExe.exe" />

<InstallExecuteSequence>
      <RemoveExistingProducts Before="InstallInitialize" /> 
      <Custom Action="LaunchApp" After="InstallFinalize" />
    </InstallExecuteSequence>

but when i start the installer, a window pops up: "Please wait while Windows configures MyProgram". and on top of it comes cmd.exe just with a blinking cursor, when i close cmd i get message :"There is a problem with this Windows Installer package. A program required for this install to complete could not be run." Though program remains opened. How can i do that properly (without any UI)? Thanks in advance!

回答1:

What happens if you use

ExeCommand="[SystemFolder]cmd.exe /C start MyExe.exe"


回答2:

Set Return to asyncNoWait for your custom action. This way the custom action runs and the installer doesn't wait for it or check its return code.



回答3:

I had the problem that it also tried to run at uninstallation.. This way it runs only on installation, reparation and updating (changing)

<CustomAction Id="LaunchApp" Directory="INSTALLFOLDER" ExeCommand="[SystemFolder]cmd.exe /C start MyFile.exe" />

<InstallExecuteSequence>
  <Custom Action="LaunchApp" After="InstallFinalize">NOT REMOVE</Custom>
</InstallExecuteSequence>

Information about NOT REMOVE could be found here: https://stackoverflow.com/a/17608049/9758687



标签: wix