Reputation: 35229
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?
Upvotes: 4
Views: 6165
Reputation: 32240
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"/>
Upvotes: 12