Skip to content

Instantly share code, notes, and snippets.

@dander
Created January 13, 2014 21:20
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dander/8408382 to your computer and use it in GitHub Desktop.
Save dander/8408382 to your computer and use it in GitHub Desktop.
Upgrade detection properties for WiX (not tested but looks like a handy thing to have). I'm actually thinking this might make more sense in a Fragment instead of Include. based on: http://code.dblock.org/msi-property-patterns-upgrading-firstinstall-and-maintenance#comment-695361597
<?xml version="1.0" encoding="utf-8"?>
<Include xmlns="http://schemas.microsoft.com/wix/2006/wi">
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." Schedule="afterInstallInitialize"/>
<SetProperty Id="FirstInstall" After="FindRelatedProducts" Value="true">
NOT Installed AND NOT WIX_UPGRADE_DETECTED AND NOT WIX_DOWNGRADE_DETECTED
</SetProperty>
<SetProperty Id="Upgrading" After="SetFirstInstall" Value="true">
WIX_UPGRADE_DETECTED AND NOT (REMOVE="ALL")
</SetProperty>
<SetProperty Id="RemovingForUpgrade" After="RemoveExistingProducts" Sequence="execute" Value="true">
(REMOVE="ALL") AND UPGRADINGPRODUCTCODE
</SetProperty>
<SetProperty Id="Uninstalling" After="SetUpgrading" Value="true">
Installed AND (REMOVE="ALL") AND NOT (WIX_UPGRADE_DETECTED OR UPGRADINGPRODUCTCODE)
</SetProperty>
<SetProperty Id="Maintenance" After="SetUninstalling" Value="true">
Installed AND NOT Upgrading AND NOT Uninstalling AND NOT UPGRADINGPRODUCTCODE
</SetProperty>
</Include>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment