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 and installed state of features and components or check the values of your custom properties. Look back to Chapter 4, Improving Control with Launch Conditions and Installed States, to review the discussion about these...