0

I have installed major upgrade (say #206) successfully and included code as in (#206):

<Upgrade Id="$(var.ProductUpgradeCode)">
  <UpgradeVersion Minimum="$(var.ProductVersion)" IncludeMinimum="no" OnlyDetect="yes" Language="1033" Property="NEWPRODUCTFOUND" />
  <UpgradeVersion Minimum="1.0.0.178" IncludeMinimum="yes" Maximum="$(var.ProductVersion)" IncludeMaximum="no" Language="1033" Property="UPGRADEFOUND" />
</Upgrade>

Scenario is: I have installed build #177 then upgraded to build #206. It is still allowed to install #177 which I want to prevent this downgrade.

From build #178 onward I have changed product GUID for major upgrade and which is working fine. Please suggest how to prevent this. I don't want to downgrade build below 177. If I have done major upgrade on build no <= 177.

4

1 回答 1

2

您的问题是默认情况下如何在 MSI 中完成版本比较 - 1.0.0.123 被视为与例如 1.0.0.33 相同。您要么必须增加修订版本以使安装程序将其检测为旧版本,要么使用解决方法。

例如,您可以创建一个自定义操作来检查这个修订版本并将其放置在例如 InstallValidate 之前:

<CustomAction Id='MyVersionCheck' Return='check' (...) />

<InstallExecuteSequence>
    <Custom Action='MyVersionCheck' Before='InstallValidate' />
</InstallExecuteSequence>

更多信息可以在这篇文章中找到,关于如何创建自定义操作的信息,我推荐这个博客条目作为起点。

于 2012-08-13T10:32:01.020 回答