Search code examples
wixwindows-installercustom-actionmosquittowix3.10

Installer waiting when EXE is run as custom action during installation


I am installing Mosquitto using WIX and once the files are copied I'm trying to run the mosquitto.exe using a custom action. It launches a new command prompt and the installation pauses there. It resumes only when I terminate that command prompt. Below is my code.

<Feature Id="ProductFeature" Title="MosquittoInstaller" Level="1">
  <ComponentGroupRef Id="MosquittoFilesGroup"/>
    </Feature>
<InstallExecuteSequence>
  <Custom Action="RunMosquitto" Before="InstallFinalize" />
</InstallExecuteSequence>


  <Directory Id="TARGETDIR" Name="SourceDir">
  <Directory Id="INSTALLLOCATION">
    <Directory Id="KubeInstallDir" Name="Kube2.0">
      <Directory Id="MyProgramDir" Name="Mosquitto" />
    </Directory>
  </Directory>
</Directory>
<CustomAction Id='RunMosquitto'  FileKey="fil7D28AEF774656849395A2FA20A5C963D"  Execute="deferred" ExeCommand='-v' Return="check" HideTarget="no" Impersonate="no"/>

What am I doing wrong here? Please advice.


Solution

  • The installation pauses because in your custom action, you have Return="check". See the CustomAction documentation for more information regarding the Return attribute.

    Return="asyncNoWait" is what you want.

    However, the WiX documentation for running a program after install shows a different way:

    <Property Id="WixShellExecTarget" Value="[#myapplication.exe]" />
    <CustomAction Id="LaunchApplication" BinaryKey="WixCA" DllEntry="WixShellExec" Impersonate="yes" />