always remove a previous version

Mar 14, 2016 at 3:09 PM
I need to reinstall the version. I found a solution:

But I ran into a problem in Compiler.cs:1292 WixSharp.Compiler.ProcessUpgradeStrategy
1284                    if (project.MajorUpgradeStrategy.PreventDowngradingVersions != null)
1285                {
1286                    VersionRange versions = project.MajorUpgradeStrategy.PreventDowngradingVersions;
1288                    var upgradeVersion = upgradeElement.AddElement(
1289                        new XElement("UpgradeVersion",
1290                               new XAttribute("Minimum", ExpandVersion(versions.Minimum)),
1291                               new XAttribute("IncludeMinimum", versions.IncludeMinimum.ToYesNo()),
1292                               new XAttribute("OnlyDetect", "yes"),
1293                               new XAttribute("Property", "NEWPRODUCTFOUND")));
I need a "upgradeVersion" without attribute "OnlyDetect".
I wished to make it in the property for VersionRange.
Mar 15, 2016 at 1:13 AM
I have added VersionRange.OnlyDetect so now you can set it if required. Though I am not sure Upgrade element it is the best way for this. This element is a way over-engineered. Even WiX team has replaced it with MajorUpgrade, which does almost the same thing as Wix# MajorUpgradeStrategy. The property AllowSameVersionUpgrades probably does what you need:
project.MajorUpgrade = new MajorUpgrade
    AllowSameVersionUpgrades = true,
    Schedule = UpgradeSchedule.afterInstallInitialize,
    DowngradeErrorMessage = "A later version of [ProductName] is already installed. Setup will now exit."
Have a look at MajorUpgrade sample.
Mar 15, 2016 at 6:36 AM
but I need to downgrade and upgrade without exiting the installation.
first uninstall the program, and then install from the installer, without checking the version.
Mar 15, 2016 at 9:49 PM
This is what WiX MajorUpgrade.AllowSameVersionUpgrades and MajorUpgrade.AllowDowngrades attributes for.
Did you tried them?