by Markus
29. October 2009 23:30
Upgrades (New Versions of your Product) need to be installed
The Important message first:
Please test the Deployment of your Version 1.1 and 2.0 and if they Upgrade the Previous Versions correctly > BEFORE < you deploy the Version 1.0!!!
Step 1
Have a look at and insert the following Tags in your Project.wxs
<?define ProductVersion="1.0.0" ?>
<?define ProductName = "TheTester"?>
<?define ProductTitle = "$(var.ProductName) $(var.ProductVersion)"?>
<?define Manufacturer="The Tester GmbH & Co. KG"?>
<?define ManufacturerFolderName="The Tester GmbH"?>
<?define ProductCode="{78BD1E9F-8DFD-443D-BD7A-0311BC0132EB}"?>
<?define UpgradeCode="{BD56AC1E-2D89-4A36-9584-935A7AC06383}"?>
<Product Id="$(var.ProductCode)"
Name="$(var.ProductTitle)"
Language="1031"
Codepage ="1252"
Version="$(var.ProductVersion)"
Manufacturer="$(var.Manufacturer)"
UpgradeCode="$(var.UpgradeCode)">
<Package Id="*"
Manufacturer="$(var.Manufacturer)"
InstallerVersion="200"
Compressed="yes"
Languages="1031"/>
Notes:
- In the first part there are some variables defined. The Variables can be used in other places. So if we need to change something we have only one place to change it…
- Product.Id: This is the so called Product Code. This has to be changed for every Version of your Product
- UpgradeCode: This has to stay the same for all versions of your product
- Language: This has to stay the same for all versions of your product
- Language defines NOT the UI language of your installer!!! the UI Language of your installer is defined in the properties page of the project under Build-Cultures to Build
- Version needs to be in the Format ##.##.####
- The Codepage in this example is for Germany
- The Package.Id needs to be change for every build of the msi, so you can just keep the * there
Step 2
You have to insert the following Tags:
<Upgrade Id='$(var.UpgradeCode)'>
<UpgradeVersion OnlyDetect='yes' Property='NEWERPRODUCTFOUND'
Minimum='$(var.ProductVersion)' IncludeMinimum='no' />
<UpgradeVersion OnlyDetect='no' Property='PREVIOUSVERSIONSINSTALLED'
Maximum='$(var.ProductVersion)' IncludeMaximum='no'/>
</Upgrade>
Notes:
- Upgrade.Id has to be the same as UpgradeCode!!!!
Step 3
You have to define a custom actions
<CustomAction Id='NoDowngrade' Error=’A newer version is already installed.' />
Step 4
You have to schedule the custom action and the removal of the application.
<InstallExecuteSequence>
<!--Check if newer Version is installed-->
<LaunchConditions After='AppSearch'></LaunchConditions>
<Custom Action='NoDowngrade' After='FindRelatedProducts'>NEWERPRODUCTFOUND</Custom>
<!--Remove existing-->
<RemoveExistingProducts After="InstallInitialize"/>
</InstallExecuteSequence>
Notes:
- The Check if a newer version is installed or not happens AFTER you are through all UI in your installer. I don’t like this behavior but I didn’t find another solution.
- The RemoveExitingProduct is scheduled before the actual installation of the new version. If you want to schedule it after the installation of the ne version you can use After=”InstallFinalize”. Actually this is the recommended time slot.
<= Back to Content
aa0aad52-5f65-43f3-8d41-0e4d2df279af|0|.0
Tags: c#, wix