aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortimberto <33670243+timberto@users.noreply.github.com>2023-04-18 12:34:25 +0200
committerRob Mensching <rob@firegiant.com>2023-06-03 01:24:39 -0700
commitf86155f6bd2be3f63b646f259f27c65b607d0368 (patch)
tree5415e245ea4c492ce03c401c64a6169fc7a039ec
parent13dbe58b6be7b7c5d6b01ef7273331fc5e2f252c (diff)
downloadwix-f86155f6bd2be3f63b646f259f27c65b607d0368.tar.gz
wix-f86155f6bd2be3f63b646f259f27c65b607d0368.tar.bz2
wix-f86155f6bd2be3f63b646f259f27c65b607d0368.zip
Show correct error message when upgrade is blocked
-rw-r--r--src/wix/WixToolset.Core/Compiler.cs2
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/TestData/Upgrade/MajorUpgradeDowngradeMessage.wxs15
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/UpgradeFixture.cs25
3 files changed, 39 insertions, 3 deletions
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
6635 this.Core.AddSymbol(new LaunchConditionSymbol(sourceLineNumbers) 6635 this.Core.AddSymbol(new LaunchConditionSymbol(sourceLineNumbers)
6636 { 6636 {
6637 Condition = WixUpgradeConstants.UpgradePreventedCondition, 6637 Condition = WixUpgradeConstants.UpgradePreventedCondition,
6638 Description = downgradeErrorMessage 6638 Description = disallowUpgradeErrorMessage
6639 }); 6639 });
6640 } 6640 }
6641 6641
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 @@
1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 <Package Name="MajorUpgradeDowngradeMessage" Language="1033" Version="2.0.0" Manufacturer="Example Corporation" UpgradeCode="7ab24276-c628-43db-9e65-a184d052909b" Scope="perMachine">
3
4 <MajorUpgrade Disallow="yes" DisallowUpgradeErrorMessage="No upgrades allowed!" DowngradeErrorMessage="No downgrades allowed!" />
5
6 <Feature Id="ProductFeature" Title="MsiPackageTitle">
7 </Feature>
8 </Package>
9
10 <Fragment>
11 <StandardDirectory Id="ProgramFiles6432Folder">
12 <Directory Id="INSTALLFOLDER" Name="MsiPackage" />
13 </StandardDirectory>
14 </Fragment>
15</Wix>
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
11 11
12 public class UpgradeFixture 12 public class UpgradeFixture
13 { 13 {
14
15 [Fact] 14 [Fact]
16 public void PopulatesInstallExecuteSequenceTable() 15 public void FailsOnInvalidVersion()
17 { 16 {
18 var folder = TestData.Get(@"TestData"); 17 var folder = TestData.Get(@"TestData");
19 18
@@ -44,5 +43,27 @@ namespace WixToolsetTest.CoreIntegration
44 Assert.Equal(242, result.ExitCode); 43 Assert.Equal(242, result.ExitCode);
45 } 44 }
46 } 45 }
46
47 [Fact]
48 public void MajorUpgradeDowngradeMessagePopulatesRowsAsExpected()
49 {
50 var folder = TestData.Get("TestData", "Upgrade");
51 var build = new Builder(folder, null, new[] { folder });
52
53 var results = build.BuildAndQuery(Build, "Upgrade", "LaunchCondition");
54 WixAssert.CompareLineByLine(new[]
55 {
56 "LaunchCondition:NOT WIX_DOWNGRADE_DETECTED\tNo downgrades allowed!",
57 "LaunchCondition:NOT WIX_UPGRADE_DETECTED\tNo upgrades allowed!",
58 "Upgrade:{7AB24276-C628-43DB-9E65-A184D052909B}\t\t2.0.0\t1033\t1\t\tWIX_UPGRADE_DETECTED",
59 "Upgrade:{7AB24276-C628-43DB-9E65-A184D052909B}\t2.0.0\t\t1033\t2\t\tWIX_DOWNGRADE_DETECTED",
60 }, results);
61 }
62
63 private static void Build(string[] args)
64 {
65 var result = WixRunner.Execute(args);
66 result.AssertSuccess();
67 }
47 } 68 }
48} 69}