Wix - Run an exe ( with arguments ) at end of install, which wasn't installed by current MSI

11,716

Have you tried changing Execute="commit" to Execute="deferred", this will make the custom action run after the installation script has run, but not after the install process has completed, for the latter you would be outside of the execution context of the install.

Share:
11,716
Tall Tyke
Author by

Tall Tyke

Updated on June 05, 2022

Comments

  • Tall Tyke
    Tall Tyke about 2 years

    I have a MSI created in WiX 3.6 that obviously installs various things and creates a shortcut to an exe that isn't actually installed by my MSI ( we know for certain that the exe is located in a specific folder, because it's installed by a seperate MSI, that is a required pre-req for my MSI ). The shortcut we create, passes in some arguments that actually tell the exe to use stuff that we've just installed. This all works fine, but I now want the MSI to automatically run the exe with the same arguments as we use in the shortcut.

    I tried following this article - http://wixtoolset.org/documentation/manual/v3/howtos/ui_and_localization/run_program_after_install.html but it assumes you want to run an exe you have just installed and doesn't seem to use exe arguments.

    I also tried using a custom action like -

    <CustomAction Id="RunMainApp"
              Directory="FREDFOLDER"
              ExeCommand="[FREDFOLDER]Fred.exe -SBDSingleApp -SBDSplash=&quot;MySplash.bmp&quot;"
              Execute="commit"
              Return="ignore"/>
    
    <InstallExecuteSequence>
      <Custom Action="RunMainApp" Before="InstallFinalize" />
    </InstallExecuteSequence>
    

    this was more promising - it ran the exe, but did so before the actual installation had finished - which obviously isn't correct.

    To be honest, I'm not that bothered if about having a UI as in the first example - because 90% of the time the MSI will be run in quiet mode without the wizard been displayed.

  • Tall Tyke
    Tall Tyke almost 11 years
    Reason I used "Commit" was that the text book I'm using as a guide, says "Setting execute to commit, schedules the action to be run once the insaallation has completed" - which sound like what I needed. But saying that I just tried what you suggested and it didn't make any difference - it still kicks off the exe before the install wizard has finished. The install may have done enough for the program to actually work, but it just "feels" wrong - having our Logon box ( first thing our app does ) while the installer wizard is still running !