Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
528 views
in Technique[技术] by (71.8m points)

wix - Majorupgrade or Upgrade ID which is preferred for Major upgrade?

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The MajorUpgrade element was introduced in wix 3.5 to simplify what you would normally do with the Upgrade element. So that instead of something like this:

<!– Major upgrade –> 
<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>

You can simply do this:

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

Not only is the old way more verbose, it also requires that you repeat the upgrade code and product version which are specified in the Product element. So the sample above has to make use of wix variables to keep them in sync. If you get that wrong, the upgrade won't work correctly.

The new MajorUpgrade element has none of those complications, so I recommend that you use it. See also this blog post by Bob Arnson introducing MajorUpgrade and the topic in the wix documentation on the subject.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...