Minor Upgrade

Sep 16, 2015 at 8:40 PM
Hi,

I did not find anything about how to set an installer using WixSharp to be able to run a minor upgrade.
Also I did not see an OnlyDetect property for UpgradeVersions or VersionRange.
Is it possible to build an installer able to run a minor upgrade? Is there an example?

Thank you.
Sep 17, 2015 at 5:37 AM
Edited Sep 17, 2015 at 5:39 AM
The same (older) upgrade XML elements that used for MinorUpgrade scenario is used by the Project.MajorUpgradeStrategy member:
project.MajorUpgradeStrategy =  new MajorUpgradeStrategy
{
    UpgradeVersions = VersionRange.OlderThanThis,
    PreventDowngradingVersions = VersionRange.NewerThanThis,
    NewerProductInstalledErrorMessage = "Newer version already installed",
};
//-------------
project.MajorUpgradeStrategy =  new MajorUpgradeStrategy
{
    UpgradeVersions = new VersionRange 
                          { 
                             Minimum = "2.0.5.0", IncludeMaximum = true,
                             Maximum = "%this%", IncludeMaximum = false
                          },
    PreventDowngradingVersions = new VersionRange 
                          { 
                             Minimum = "%this%", IncludeMinimum = false
                          },
    NewerProductInstalledErrorMessage = "Newer version already installed",
};
Wix# intention was always to provide MajorUpgrade support only. Thus Project.MajorUpgradeStrategy was eventually superceded with the Project.MajorUpgrade directly mapped to the WiX MajorUpgrade element. However the MajorUpgradeStrategy member is still available and there is a small chance that you can modify it to meet your requirements for MinorUpgrade. See MajorUpgrade sample for details.