aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Arnson <bob@firegiant.com>2021-02-07 19:06:11 -0500
committerBob Arnson <bob@firegiant.com>2021-02-08 16:20:11 -0500
commit3588e1453240ca59ead8b5f8e63cdb8989bf8f84 (patch)
tree6ad226994dfc38054be916f207e7a38673f6dc75
parent7342d571cbe4778c202e2a8beb44c7e9555dfc89 (diff)
downloadwix-3588e1453240ca59ead8b5f8e63cdb8989bf8f84.tar.gz
wix-3588e1453240ca59ead8b5f8e63cdb8989bf8f84.tar.bz2
wix-3588e1453240ca59ead8b5f8e63cdb8989bf8f84.zip
Improve duplicate-id reporting.
-rw-r--r--src/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs1
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/RegistryFixture.cs26
-rw-r--r--src/test/WixToolsetTest.CoreIntegration/TestData/Registry/DuplicateRegistryValueIds.wxs14
3 files changed, 41 insertions, 0 deletions
diff --git a/src/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs b/src/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs
index a4b2bee3..a52d0d63 100644
--- a/src/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs
+++ b/src/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs
@@ -103,6 +103,7 @@ namespace WixToolset.Core.Link
103 } 103 }
104 else 104 else
105 { 105 {
106 symbolWithSection.AddPossibleConflict(existingSymbol);
106 existingSymbol.AddPossibleConflict(symbolWithSection); 107 existingSymbol.AddPossibleConflict(symbolWithSection);
107 possibleConflicts.Add(symbolWithSection); 108 possibleConflicts.Add(symbolWithSection);
108 } 109 }
diff --git a/src/test/WixToolsetTest.CoreIntegration/RegistryFixture.cs b/src/test/WixToolsetTest.CoreIntegration/RegistryFixture.cs
index 654b8740..e4d95b5d 100644
--- a/src/test/WixToolsetTest.CoreIntegration/RegistryFixture.cs
+++ b/src/test/WixToolsetTest.CoreIntegration/RegistryFixture.cs
@@ -80,6 +80,32 @@ namespace WixToolsetTest.CoreIntegration
80 } 80 }
81 81
82 [Fact] 82 [Fact]
83 public void DuplicateRegistryValueIdsAreDetectedSmoothly()
84 {
85 var folder = TestData.Get(@"TestData");
86
87 using (var fs = new DisposableFileSystem())
88 {
89 var baseFolder = fs.GetFolder();
90 var intermediateFolder = Path.Combine(baseFolder, "obj");
91 var msiPath = Path.Combine(baseFolder, @"bin\test.msi");
92
93 var result = WixRunner.Execute(new[]
94 {
95 "build",
96 Path.Combine(folder, "Registry", "DuplicateRegistryValueIds.wxs"),
97 Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
98 "-bindpath", Path.Combine(folder, "SingleFile", "data"),
99 "-intermediateFolder", intermediateFolder,
100 "-o", msiPath
101 }, out var messages);
102
103 Assert.Equal(2, messages.Where(m => m.Id == (int)ErrorMessages.Ids.DuplicateSymbol).Count());
104 Assert.Equal(2, messages.Where(m => m.Id == (int)ErrorMessages.Ids.DuplicateSymbol2).Count());
105 }
106 }
107
108 [Fact]
83 public void PopulatesRegistryTableFromRemoveRegistryKey() 109 public void PopulatesRegistryTableFromRemoveRegistryKey()
84 { 110 {
85 var folder = TestData.Get(@"TestData"); 111 var folder = TestData.Get(@"TestData");
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Registry/DuplicateRegistryValueIds.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Registry/DuplicateRegistryValueIds.wxs
new file mode 100644
index 00000000..452aea69
--- /dev/null
+++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Registry/DuplicateRegistryValueIds.wxs
@@ -0,0 +1,14 @@
1<?xml version="1.0" encoding="utf-8" ?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 <Fragment>
4 <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
5 <Component>
6 <RegistryKey Root="HKLM" Key="Software\Acme\Foobar 1.0">
7 <RegistryValue Type="string" Name="InstallDir" Value="[TARGETDIR]" />
8 <RegistryValue Type="string" Name="InstallDir" Value="[INSTALLDIR]" />
9 <RegistryValue Type="string" Name="InstallDir" Value="[ProgramFilesFolder]" />
10 </RegistryKey>
11 </Component>
12 </ComponentGroup>
13 </Fragment>
14</Wix>