Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to run custom action based on condition?

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!

like image 296
Facy87 Avatar asked Feb 09 '15 16:02

Facy87


People also ask

What are the types of conditions in the custom actions during installation only?

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.

Where do custom action execute?

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.

What is MSI custom action?

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.


1 Answers

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>
like image 129
user145400 Avatar answered Sep 28 '22 08:09

user145400