Wix V4 – 仅在更新时自定义操作条件

huangapple go评论51阅读模式
英文:

Wix V4 - CustomAction Condition only when updating

问题

问题细节:

我有一个在卸载时执行的操作,但在将产品更新到新版本时不执行。

我已经这样定义了UpgradeVersion:

                Minimum="1.0.0" IncludeMinimum="yes"
                Maximum="$(var.Version)" IncludeMaximum="no"/>

这是自定义操作及其条件:

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

尽管如此,当使用更高版本的.msi运行时,该操作仍然触发(例如:1.0.0 -> 1.0.1)。

我还尝试过像这样定义PREVIOUSFOUND属性:<Property Id="PREVIOUSFOUND" Secure="yes"></Property>,但无济于事。

我的期望:

我期望该操作仅在从控制面板“应用和功能”卸载时运行,而在将程序更新到更高版本时不运行。

英文:

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.

答案1

得分: 2

根据Stein的评论,我在此帖子中找到了解决方案。

所以我将我的条件更改为<Custom Action="DOSTUFF" Before="RemoveFiles" Condition='(REMOVE="ALL") And (NOT UPGRADINGPRODUCTCODE)'/>,现在CustomAction被正确触发。

英文:

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.

huangapple
  • 本文由 发表于 2023年3月15日 17:37:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/75742871.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定