I'm trying to run a custom action (delete a certain file) based on the windows version. I know how to check for the windows version:
<Condition Message="Windows version xxx required...">
<![CDATA[Installed OR (VersionNT >= 600)]]>
</Condition>
However, I do not want to display a message, but delete a file. I can't find an example on how to use such a condition to run oder not to run a custom action!
Any custom action in an MSI package uses a condition which determines if it will run or not. This condition can be null (always execute), Not Installed (only during the first installation), Remove = "ALL" (only during uninstall) etc. In order to execute a custom action during a patch, you can add the condition PATCH.
Because a custom action can be scheduled in both the UI and execute sequence tables, and can be executed either in the service or client process, a custom action can potentially execute multiple times. Note that the installer: Executes actions in a sequence table immediately by default.
The custom actions are the actions that can be performed together with the MSI package install and/or uninstall process. They can be used, for example, to prepare the system for installation of the package, to check prerequisites, to start the application on installation completion, etc.
You need to specify the condition inside the Custom element which runs your custom action. (This allows you to run the custom action multiple times in different locations in your sequence and with different conditions each time if desired).
Example:
<InstallExecuteSequence>
<Custom Action="CreateRegistryEntries" After="CostInitialize">
NOT Installed AND NOT PATCH
</Custom>
</InstallExecuteSequence>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With