Adding conditions to custom actions

After you've defined your custom actions and scheduled them into either InstallUISequence or InstallExecuteSequence, you have the option of adding conditions to them. These are added as the inner text of the Custom element and prevent the action from running if the condition is false. A common use for this is to only run the action during installation by using the NOT Installed condition.

<InstallExecuteSequence>
   <Custom Action="myCustomAction" After="InstallInitialize">
     NOT Installed
   </Custom>
</InstallExecuteSequence>

Other common conditions are Installed, which is true if the software is already installed, and REMOVE="ALL", which is true if the product is being uninstalled.

You can also use the action state ...

Get WiX 3.6: A Developer's Guide to Windows Installer XML now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.