aiGreek
aiGreek

Reputation: 41

Wix V4 - CustomAction Condition only when updating

Details of the problem:

I have an action that has to be executed when unistalling but not when updating the product to a new version.

I have defined the UpgradeVersion like this:

<UpgradeVersion OnlyDetect="no" Property="PREVIOUSFOUND"
                Minimum="1.0.0" IncludeMinimum="yes"
                Maximum="$(var.Version)" IncludeMaximum="no"/>

and this is the Custom action and its Condition:

<Custom Action="DOSTUFF" Before="RemoveFiles" Condition='(REMOVE="ALL") And (NOT PREVIOUSFOUND)'/>

Despite this, the action still fires when running the .msi with a higher version (e.g.: 1.0.0 -> 1.0.1).

I've also tried defining the PREVIOUSFOUND property like this: <Property Id="PREVIOUSFOUND" Secure="yes"></Property> to no avail.

What I was expecting:

I expected the action to run only when uninstalling from the Control Panel Apps & Features and not when updating the program to a higher version.

Upvotes: 1

Views: 920

Answers (1)

aiGreek
aiGreek

Reputation: 41

As per Stein's comment, I found a solution in this post.

So I changed my condition to <Custom Action="DOSTUFF" Before="RemoveFiles" Condition='(REMOVE="ALL") And (NOT UPGRADINGPRODUCTCODE)'/> and now the CustomAction is triggered correctly.

Upvotes: 2

Related Questions