Skip to Content

Major upgrades now easier than ever

I’m a fan of major upgrades, which I’ve written about before. For 10 lines of XML, you get free and easy upgrades without having to deal with the costs of patching and minor upgrades:

<! – Major upgrade – >


Easy enough to cut and paste but it isn’t exactly what I would call _expressive_—the intent behind the code isn’t obvious, though it can be deduced fairly easily.

WiX can do better.

So, like the last time I tweaked the WiX language, it’s time for a new feature: The MajorUpgrade element encapsulates the most common options for major upgrades and creates the appropriate rows in the Upgrade and LaunchCondition tables and provides a simpler way of specifying the scheduling of the RemoveExistingProducts action. For example, here’s the simplest use:

Downgrades are blocked by default, which requires you to specify a message for the launch condition message.

MajorUpgrade is a child of the Product element and automatically picks up the UpgradeCode attribute from its parent. That avoids the common duplication of the upgrade code in the Upgrade element.

MajorUpgrade has the following attributes:

AllowDowngrades Downgrades are blocked by default.
DowngradeErrorMessage The launch condition message displayed when a downgrade is detected.
IgnoreRemoveFailure Uninstall failures are upgrade failures by default.
MigrateFeatures Manual control over the features installed in the newer product.
RemoveFeatures Manual control over the features removed from the older product.
Schedule When to schedule the RemoveExistingProducts action.

For details, see the MajorUpgrade element documentation. The feature ships in WiX v3.5.1315.0 and later.