2

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.

AnOldSoul
  • 4,017
  • 12
  • 57
  • 118

1 Answers1

3

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" />
BryanJ
  • 8,485
  • 1
  • 42
  • 61
  • Regarding the second approach you mentioned, can you tell me how I can pass the argument to the installer? I will specify "mosquitto.exe" in Value section under Property. But what about the argument "-v" ? – AnOldSoul Jun 29 '16 at 23:20
  • I'm not 100% sure. I would try something like `Value="[#myapplication.exe] -v"` or `Value='"[#myapplication.exe]" -v'` and see how it behaves. – BryanJ Jun 30 '16 at 01:05
  • 1
    Sorry @mayooran looks like I steered you wrong earlier. I guess the correct way to use command line parameters is to us a standard custom action as you were. – BryanJ Jul 01 '16 at 06:20