diff --git a/src/wix/WixToolset.Core/Link/AddDefaultSymbolsCommand.cs b/src/wix/WixToolset.Core/Link/AddDefaultSymbolsCommand.cs index 28ad93513..3d5280a22 100644 --- a/src/wix/WixToolset.Core/Link/AddDefaultSymbolsCommand.cs +++ b/src/wix/WixToolset.Core/Link/AddDefaultSymbolsCommand.cs @@ -99,6 +99,7 @@ private void AddDefaultMajorUpgrade(WixPackageSymbol packageSymbol) SequenceTable = SequenceTable.InstallExecuteSequence, Action = "RemoveExistingProducts", After = "InstallValidate", + Overridable = true, }, new WixSimpleReferenceSymbol(packageSymbol.SourceLineNumbers) { @@ -126,7 +127,10 @@ private void AddSymbols(IntermediateSection section, params IntermediateSymbol[] { var symbolWithSection = new SymbolWithSection(section, symbol); var fullName = symbolWithSection.GetFullName(); - this.Find.SymbolsByName.Add(fullName, symbolWithSection); + if (!this.Find.SymbolsByName.ContainsKey(fullName)) + { + this.Find.SymbolsByName.Add(fullName, symbolWithSection); + } } } } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DefaultMajorUpgradeReschedule/DefaultMajorUpgradeReschedule.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DefaultMajorUpgradeReschedule/DefaultMajorUpgradeReschedule.wxs new file mode 100644 index 000000000..3269106b9 --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/DefaultMajorUpgradeReschedule/DefaultMajorUpgradeReschedule.wxs @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs index 72d09b637..2d2c0703f 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs @@ -73,6 +73,20 @@ public void DefaultMajorUpgradePopulatesUpgradeRowsAsExpected() }, results); } + [Fact] + public void CanRescheduleRemoveExistingProductsWithDefaultMajorUpgrade() + { + var folder = TestData.Get("TestData", "DefaultMajorUpgradeReschedule"); + var build = new Builder(folder, new Type[] { }, new[] { folder }); + + var results = build.BuildAndQuery(Build, "InstallExecuteSequence").Where(r => r.StartsWith("InstallExecuteSequence:RemoveExistingProducts") || r.StartsWith("InstallExecuteSequence:InstallFinalize")).ToArray(); + WixAssert.CompareLineByLine(new[] + { + "InstallExecuteSequence:InstallFinalize\t\t6600", + "InstallExecuteSequence:RemoveExistingProducts\t\t6601", + }, results); + } + [Fact] public void CanOverrideDefaultMajorUpgradeLaunchConditionMessage() {