WiX-通过检查修订来防止降级 [英] WiX - Prevent downgrade with check for revision

查看:85
本文介绍了WiX-通过检查修订来防止降级的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找防止应用程序降级的方法。但是问题是,我必须检查修订号

I am searching a way to prevent a downgrade of my application. But the "problem" is, that I have to check the revision-number

例如:
应该可以在1.0时安装1.0.0.2。已安装0.1-但是在安装1.0.0.2时应该不可能安装1.0.0.1。

for example: it should be possible to install 1.0.0.2 when 1.0.0.1 is installed - but it should not be possible to install 1.0.0.1 when 1.0.0.2 is installed.

我知道,元素MajorUpgrade仅检查前三个标记。
也许有人可以给我一个主意,该怎么做?我可以编写CustomAction来做到这一点吗? -是时,如何检查CustomAction应该安装哪个版本和安装哪个版本?
我必须在哪里调用CustomAction,如何显示消息并阻止从CustomAction安装?

I know, that the Element MajorUpgrade only check the first three tokens. Perhaps someone can give me an idea, how to do this? Can I wrote a CustomAction to do this? - When yes, how can I check in the CustomAction which version should be installed and which version is installed? Where does I have to call the CustomAction and how can I show a message and prevent installing from the CustomAction?

推荐答案

这是常见要求。经常使用以下模式:

This is a common requirement. The following pattern frequently used:

<Upgrade Id="THE-PRODUCT-GUID">
  <UpgradeVersion Property="PREVIOUSVERSIONINSTALLED" Minimum="1.0.0.0" Maximum="$(var.packageVersion)"
          IncludeMinimum="yes" IncludeMaximum="no" MigrateFeatures="yes" />
          IncludeMinimum="yes" IncludeMaximum="yes" />
  <UpgradeVersion Property="NEWERVERSIONINSTALLED" Minimum="$(var.packageVersion)" Maximum="99.0.0.0"
          IncludeMinimum="no" IncludeMaximum="yes" />
</Upgrade>

<InstallExecuteSequence>
  <Custom Action="PreventDowngrading" After="FindRelatedProducts">NEWERVERSIONINSTALLED&lt;&gt;"" AND NOT Installed</Custom>
  <RemoveExistingProducts After="InstallInitialize">PREVIOUSVERSIONINSTALLED&lt;&gt;""</RemoveExistingProducts>
</InstallExecuteSequence>

PreventDowngrading 自定义操作本质上是一个重大错误:

PreventDowngrading custom action is essentially a breaking error:

<CustomAction Id="PreventDowngrading" Error="Newer version already installed." />

这篇关于WiX-通过检查修订来防止降级的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆