aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Mensching <rob@firegiant.com>2023-01-20 09:52:33 -0800
committerRob Mensching <rob@firegiant.com>2023-01-20 10:45:32 -0800
commit7a3869780e294be7d4ae38d1215c6e5e84798d2f (patch)
tree9b5dbfb55baea04041685d7f07177ee91dbb7641 /src
parent95ee410bf6092e62d53b657f61c7f1d1fdede572 (diff)
downloadwix-7a3869780e294be7d4ae38d1215c6e5e84798d2f.tar.gz
wix-7a3869780e294be7d4ae38d1215c6e5e84798d2f.tar.bz2
wix-7a3869780e294be7d4ae38d1215c6e5e84798d2f.zip
Display error correctly with multiple properties in a Property value
Fixes 7173
Diffstat (limited to 'src')
-rw-r--r--src/wix/WixToolset.Core/Compiler.cs2
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/MsiFixture.cs27
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/TestData/Property/BadProperty.wxs13
3 files changed, 41 insertions, 1 deletions
diff --git a/src/wix/WixToolset.Core/Compiler.cs b/src/wix/WixToolset.Core/Compiler.cs
index 3da24e2f..fa53b4d0 100644
--- a/src/wix/WixToolset.Core/Compiler.cs
+++ b/src/wix/WixToolset.Core/Compiler.cs
@@ -365,7 +365,7 @@ namespace WixToolset.Core
365 break; 365 break;
366 } 366 }
367 367
368 var id = value.Substring(start + 1, end - 1); 368 var id = value.Substring(start + 1, end - start - 1);
369 if (Common.IsIdentifier(id)) 369 if (Common.IsIdentifier(id))
370 { 370 {
371 this.Core.Write(WarningMessages.PropertyValueContainsPropertyReference(sourceLineNumbers, propertyId.Id, id)); 371 this.Core.Write(WarningMessages.PropertyValueContainsPropertyReference(sourceLineNumbers, propertyId.Id, id));
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/MsiFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/MsiFixture.cs
index 808f9d92..a7dbe542 100644
--- a/src/wix/test/WixToolsetTest.CoreIntegration/MsiFixture.cs
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/MsiFixture.cs
@@ -495,6 +495,33 @@ namespace WixToolsetTest.CoreIntegration
495 } 495 }
496 496
497 [Fact] 497 [Fact]
498 public void CannotBuildBadProperty()
499 {
500 var folder = TestData.Get(@"TestData", "Property");
501
502 using (var fs = new DisposableFileSystem())
503 {
504 var baseFolder = fs.GetFolder();
505 var intermediateFolder = Path.Combine(baseFolder, "obj");
506
507 var result = WixRunner.Execute(new[]
508 {
509 "build",
510 Path.Combine(folder, "BadProperty.wxs"),
511 "-intermediateFolder", intermediateFolder,
512 "-o", Path.Combine(baseFolder, "bin", "test.msi")
513 });
514
515 var messages = result.Messages.Select(m => m.ToString()).ToArray();
516 WixAssert.CompareLineByLine(new[]
517 {
518 "The 'Break' Property contains '[X]' in its value which is an illegal reference to another property. If this value is a string literal, not a property reference, please ignore this warning. To set a property with the value of another property, use a CustomAction with Property and Value attributes.",
519 "The 'Break' Property contains '[Y]' in its value which is an illegal reference to another property. If this value is a string literal, not a property reference, please ignore this warning. To set a property with the value of another property, use a CustomAction with Property and Value attributes.",
520 }, messages);
521 }
522 }
523
524 [Fact]
498 public void CanBuildSetProperty() 525 public void CanBuildSetProperty()
499 { 526 {
500 var folder = TestData.Get(@"TestData\SetProperty"); 527 var folder = TestData.Get(@"TestData\SetProperty");
diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Property/BadProperty.wxs b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Property/BadProperty.wxs
new file mode 100644
index 00000000..2ab6f7d8
--- /dev/null
+++ b/src/wix/test/WixToolsetTest.CoreIntegration/TestData/Property/BadProperty.wxs
@@ -0,0 +1,13 @@
1<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
2 <Package Name="Bad Property" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="047730a5-30fe-4a62-a520-da9381b8226a">
3 <MajorUpgrade DowngradeErrorMessage="Downgrade error message." />
4
5 <Property Id="Break" Value="[X] [Y]" />
6
7 <Feature Id="ProductFeature">
8 <Component Directory="ProgramFilesFolder" Subdirectory="MsiPackage">
9 <File Source="BadProperty.wxs" />
10 </Component>
11 </Feature>
12 </Package>
13</Wix>