Adding conditions to custom actions
After you've defined your custom actions and scheduled them into either the InstallUISequence
or the 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", which contains a list of features that are being uninstalled.
You can also use the action state and installed state of features and components or check the values of properties. Look back to Chapter 4 to review the discussion about these types of conditional statements. It's a good idea to...