Automatic account creation is now enabled. Captcha authentication required for account creation and editing unless you are trusted here.

Upgrade

From WiX Wiki at MindCapers

Jump to: navigation, search

Contents

Thought Process

To make a Major Upgrade, take your current WiX file and:

  • Change the Product Version - This would be the Version atttribute of the Product Element.
  • Change the Product Code - This would be the Id atttribute of the Product Element.
  • Change the Package Code - This can be set with the Package Element's Id attribute, but it is better to leave this blank and let it be auto-generated with each new build.
  • Leave the Upgrade Code the same

Create an Upgrade table like this:

 
 <Upgrade Id="YOUR-UPGRADE-GUID">
    <UpgradeVersion Property="OLDAPPFOUND" IncludeMinimum="yes" Minimum="0.0.0.0" IncludeMaximum="no" Maximum="THIS-PRODUCT-VERSION"/>
    <UpgradeVersion Property="NEWAPPFOUND" IncludeMinimum="no" Minimum="THIS-PRODUCT-VERSION"  OnlyDetect="yes"/>
 </Upgrade>
 

Changing YOUR-UPGRADE-GUID and THIS-PRODUCT-VERSION for the appropriate values.

Add RemoveExistingProducts to the InstallExecuteSequence. There are a few places you can add it, with differing affects. See here: http://msdn2.microsoft.com/en-us/library/aa371197.aspx

The NEWAPPFOUND bit is for stopping downgrade. If you don't care about this you can omit that entry in the Upgrade Table and ignore the following. Otherwise: Add a custom error like this:

 
 <UI>
    <Error Id="2000">There is a later version of this product installed</Error> 
 <UI>
 

Create a Custom Action like this:

 
 <CustomAction Id="NewerVersionDetected" Error="2000"/>
 

and finally add this to your execute sequences:

 
 <Custom Action="NewerVersionDetected" After="FindRelatedProducts">NEWAPPFOUND</Custom>
 

Snippet

Providing your old package made in InstallShield is MSI based, you can perform a major upgrade by including the old package's UpgradeCode in the new package's Upgrade Table.

 
    <Upgrade Id='529189FE-FD0E-44ff-8DA6-B4FB5CC7A78B'>
        <UpgradeVersion 
             OnlyDetect='yes' 
             Property='PATCHFOUND'
             Minimum='1.0.1' 
             IncludeMinimum='yes' 
             Maximum='1.0.1'
             IncludeMaximum='yes' /><br />
        <UpgradeVersion 
             OnlyDetect='yes' 
             Property='NEWERFOUND'
             Minimum='1.0.1' 
             IncludeMinimum='no' />
    </Upgrade>
 

Another Clue

It is much simpler then what you are proposing. Simply add the UpgadeCode of the old product to the Upgrade table of your new product. The old one will be uninstalled in the same manner as a previous version...silently during the RemoveExistingProducts action.


Using ARPINSTALLLOCATION for remembering previous install location

Since you are probably already saving the install location in ARPINSTALLLOCATION with something along the lines of

 
<CustomAction Id="SaveTargetDir" Property="ARPINSTALLLOCATION" Value="[INSTALLDIR]" />
...
<InstallExecuteSequence>
      <Custom Action="SaveTargetDir" After="InstallValidate">
        NOT
        Installed
      </Custom>
</InstallExecuteSequence>
 

It makes sense to use a saved ARPINSTALLOCATION to set the default installation folder when upgrading.

This can be done by sequencing AppSearch after FindRelatedProducts, as FindRelatedProducts is what is setting the OLDAPPFOUND property to the product code of the old version.

 
<InstallUISequence>
      <!-- App search is what does FindInstallLocation, and it is dependent on FindRelatedProducts -->
      <AppSearch After="FindRelatedProducts"/>
</InstallUISequence>
 
    <!-- Find previous installation -->
    <Property Id="INSTALLDIR">
      <RegistrySearch Id="FindInstallLocation"
          Root="HKLM"
          Key="Software\Microsoft\Windows\CurrentVersion\Uninstall\[OLDERVERSIONBEINGUPGRADED]"
          Name="InstallLocation"
          Type="raw" />
    </Property>
 
Personal tools