David Gardiner's answer hinted at the right decision in my case. Creating your own custom action is not required. Here's how to do it for a 64-bit installation of Windows:
First determine if MSMQ is installed:
<Property Id="MSMQINSTALLED"> <RegistrySearch Id="MSMQVersion" Root="HKLM" Key="SOFTWARE\Microsoft\MSMQ\Parameters" Type="raw" Name="CurrentBuild" /> </Property>
Announce your custom actions. You need two. One to set the properties of the path to the mind, and the other to execute it:
<CustomAction Id="InstallMsmq_Set" Property="InstallMsmq" Value=""[System64Folder]dism.exe" /online /enable-feature /featurename:msmq-server /all" Execute="immediate"/> <CustomAction Id="InstallMsmq" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="deferred" Return="check"/>
Finally, specify user actions in the installation sequence:
<InstallExecuteSequence> <Custom Action="InstallMsmq_Set" After="CostFinalize"/> <Custom Action="InstallMsmq" After="InstallInitialize">NOT REMOVE AND NOT MSMQINSTALLED</Custom> </InstallExecuteSequence>
Since this may take a little time, I added the following to update the installer status text:
<UI> <ProgressText Action="InstallMsmq">Installing MSMQ</ProgressText> </UI>
You can also specify the rollback action if you want to uninstall MSMQ if the installation fails.
source share