1

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.

aiGreek
  • 41
  • 4
  • For now, [please read this answer](https://stackoverflow.com/a/59666105/129130). Follow the links and check if this clarifies things for you. Throwing in [this old answer on conditions](https://stackoverflow.com/a/47944773/129130). – Stein Åsmul Mar 15 '23 at 11:47
  • Hello @SteinÅsmul, thanks for your help! I've started using `UPGRADINGPRODUCTCODE` rather than the property I defined and it seems to have solved my issue. – aiGreek Mar 16 '23 at 07:25
  • [Use messageboxes](https://stackoverflow.com/a/52377800/129130) (section towards bottom) to determine if your conditions are set correctly by invoking different installation modes (install, uninstall, upgrade, patch, modify, self-repair, etc...) and observe the results. – Stein Åsmul Mar 17 '23 at 12:55

1 Answers1

2

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.

aiGreek
  • 41
  • 4