12

We are trying to do Major upgrade. While i was investigating i found 2 approaches.

One is using Upgrade Id and another one approach was Majorupgrade tag.

It seems Majorupgrade is easy to do it seems. But schedule doesn't contain any before installinitialize action.

I am not sure which should be using .

Which one is preferred [and recommended] mostly?

4

1 回答 1

25

在wix 3.5 中引入了MajorUpgrade元素,以简化您通常使用Upgrade元素所做的事情。所以,而不是这样的东西:

<!– Major upgrade –&gt; 
<Upgrade Id="$(var.UpgradeCode)"> 
    <UpgradeVersion Minimum="$(var.ProductVersion)" OnlyDetect="yes" Property="NEWERVERSIONDETECTED" /> 
    <UpgradeVersion Minimum="1.0.0" IncludeMinimum="yes" Maximum="$(var.ProductVersion)" IncludeMaximum="no" Property="OLDERVERSIONBEINGUPGRADED" /> 
</Upgrade>

<InstallExecuteSequence> 
    <RemoveExistingProducts After="InstallValidate" /> 
</InstallExecuteSequence>

<Condition Message="Can't downgrade"> 
    NOT NEWERVERSIONDETECTED 
</Condition>

你可以简单地这样做:

<MajorUpgrade DowngradeErrorMessage="Can’t downgrade." />

旧方法不仅更冗长,还要求您重复在Product元素中指定的升级代码和产品版本。所以上面的示例必须使用 wix 变量来保持它们同步。如果你弄错了,升级将无法正常工作。

MajorUpgrade元素没有这些复杂性,因此我建议您使用它。另请参阅Bob Arnson 的这篇博客文章,MajorUpgrade以及有关该主题的 wix 文档中的主题。

于 2012-06-14T07:49:13.640 回答