Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Execute a custom action before Product condition

Basically I need to verify that a certain program is not running before installation. This is done via a custom action, which sets a property, APPRUNNING:

<CustomAction Id="CheckingAppIsRunning"
          BinaryKey="AppIsRunning"
          DllEntry="AppIsRunning"/>

<Binary Id="AppIsRunning" 
        SourceFile="CustomActions.CA.dll" />

But in the message displayed, APPRUNNING seems to be null, that is, it's not set at all (should be either "0" or "1").

<Condition Message="Exit all instances of [APPNAME] before installation (APPRUNNING = [APPRUNNING]).">
    <![CDATA[APPRUNNING = "0"]]>
</Condition>

<InstallExecuteSequence>
    <Custom Action="CheckingAppIsRunning" Before="LaunchConditions" />
</InstallExecuteSequence>

I suppose the custom action is not executed at the moment of the condition check. What are the options to perform a condition check after a custom action?

like image 743
Petr Abdulin Avatar asked Oct 21 '25 04:10

Petr Abdulin


1 Answers

The LaunchConditions action is scheduled to run in both InstallUISequence and InstallExecuteSequence. As long as you schedule your custom action to InstallExecuteSequence only, the property won't be set by the time LaunchConditions is fired in InstallUISequence.

You should schedule your CheckingAppIsRunning custom action in both sequences. You might also want to define it with Execute='firstSequence' attribute - this way it will run the first sequence it is met in.

This is what I mean, actually:

<InstallUISequence>
  <Custom Action="CheckingAppIsRunning" Before="LaunchConditions" />
</InstallUISequence>
<InstallExecuteSequence>
  <Custom Action="CheckingAppIsRunning" Before="LaunchConditions" />
</InstallExecuteSequence>

And the definition:

<CustomAction Id="CheckingAppIsRunning" BinaryKey="AppIsRunning" DllEntry="AppIsRunning" Execute="firstSequence"/>
like image 135
Yan Sklyarenko Avatar answered Oct 23 '25 22:10

Yan Sklyarenko



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!