简体   繁体   中英

Using WIX want to make a package that will update an existing installation and also install the application for the first time

In various places I have read statements similar to "an update packaged as a full MSI package can behave as a first-time installation if a particular user does not have an earlier version of your product installed".

But it is proving difficult to do this.

I have an install package that installs nicely. But when I add the Upgrade element below, it doesn't do a first time install any more.

<Upgrade Id="DE3F65C6-FAAF-4FE0-8D3A-87E4A1F5E36F">
    <UpgradeVersion OnlyDetect="no" Minimum="4.1.0.0" IncludeMinimum="yes" Maximum="5.0.0.7" IncludeMaximum="no" Property="PREVIOUSVERSIONFOUND" />
</Upgrade>

The Id above is the same as in the UpgradeCode attribute of the Product element. I'm sure there's something I should do in that Upgrade element, but can anyone tell me what?

One potential issue you might see here is the fact that Windows Installer only cares about the first 3 values in a version number. Microsoft say that the fourth number is purely for internal build tracking, and therefore released installers should not care about it.

So Windows Installer sees 5.0.0.1 as the same version as 5.0.0.30.

Also, unless you need some kind of complicated upgrade logic, I would suggest possibly using the MajorUpgrade element instead, as it removes a lot of the pain of just authoring a package that will do standard Major Upgrades. The documentation on it can be found here

Another point of confusion could be the fact that while under the covers the installer will essentially treat a Major Upgrade as an uninstall followed by a fresh reinstall, the UI you have set up may not behave in the same way, especially if you are just using one of the default UI Dialog sets.

Does StackOverflow award a "Hits forehead while exclaiming I'm an idiot" badge?

The problem was nowhere near where I was looking. Just so that anyone else looking for the answer to my question comes here, the real answer is to include that element which I referred to in my question (obviously with Id and version numbers modified for your particular situation).

My package also has

    <InstallExecuteSequence>
        <RemoveExistingProducts Before="InstallInitialize" />
    </InstallExecuteSequence>

It may not be absolutely necessary, but it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM