From f86155f6bd2be3f63b646f259f27c65b607d0368 Mon Sep 17 00:00:00 2001 From: timberto <33670243+timberto@users.noreply.github.com> Date: Tue, 18 Apr 2023 12:34:25 +0200 Subject: Show correct error message when upgrade is blocked --- src/wix/WixToolset.Core/Compiler.cs | 2 +- .../Upgrade/MajorUpgradeDowngradeMessage.wxs | 15 +++++++++++++ .../UpgradeFixture.cs | 25 ++++++++++++++++++++-- 3 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 src/wix/test/WixToolsetTest.CoreIntegration/TestData/Upgrade/MajorUpgradeDowngradeMessage.wxs diff --git a/src/wix/WixToolset.Core/Compiler.cs b/src/wix/WixToolset.Core/Compiler.cs index 70e246a5..36fd35b2 100644 --- a/src/wix/WixToolset.Core/Compiler.cs +++ b/src/wix/WixToolset.Core/Compiler.cs @@ -6635,7 +6635,7 @@ namespace WixToolset.Core this.Core.AddSymbol(new LaunchConditionSymbol(sourceLineNumbers) { Condition = WixUpgradeConstants.UpgradePreventedCondition, - Description = downgradeErrorMessage + Description = disallowUpgradeErrorMessage }); } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Upgrade/MajorUpgradeDowngradeMessage.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Upgrade/MajorUpgradeDowngradeMessage.wxs new file mode 100644 index 00000000..7d964dab --- /dev/null +++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Upgrade/MajorUpgradeDowngradeMessage.wxs @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs index 2b6590ee..5d0b69d1 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs @@ -11,9 +11,8 @@ namespace WixToolsetTest.CoreIntegration public class UpgradeFixture { - [Fact] - public void PopulatesInstallExecuteSequenceTable() + public void FailsOnInvalidVersion() { var folder = TestData.Get(@"TestData"); @@ -44,5 +43,27 @@ namespace WixToolsetTest.CoreIntegration Assert.Equal(242, result.ExitCode); } } + + [Fact] + public void MajorUpgradeDowngradeMessagePopulatesRowsAsExpected() + { + var folder = TestData.Get("TestData", "Upgrade"); + var build = new Builder(folder, null, new[] { folder }); + + var results = build.BuildAndQuery(Build, "Upgrade", "LaunchCondition"); + WixAssert.CompareLineByLine(new[] + { + "LaunchCondition:NOT WIX_DOWNGRADE_DETECTED\tNo downgrades allowed!", + "LaunchCondition:NOT WIX_UPGRADE_DETECTED\tNo upgrades allowed!", + "Upgrade:{7AB24276-C628-43DB-9E65-A184D052909B}\t\t2.0.0\t1033\t1\t\tWIX_UPGRADE_DETECTED", + "Upgrade:{7AB24276-C628-43DB-9E65-A184D052909B}\t2.0.0\t\t1033\t2\t\tWIX_DOWNGRADE_DETECTED", + }, results); + } + + private static void Build(string[] args) + { + var result = WixRunner.Execute(args); + result.AssertSuccess(); + } } } -- cgit v1.2.3-55-g6feb