@joebigelow / wix-1 / commits / 3588e145

Improve duplicate-id reporting.

Bob Arnson committed Feb 7, 2021 at 19:06 UTC 3588e1453240ca59ead8b5f8e63cdb8989bf8f84
3 files changed +41
src/WixToolset.Core/Link/FindEntrySectionAndLoadSymbolsCommand.cs
+1
@@ -103,6 +103,7 @@ namespace WixToolset.Core.Link
103 }
104 else
105 {
106 + symbolWithSection.AddPossibleConflict(existingSymbol);
107 existingSymbol.AddPossibleConflict(symbolWithSection);
108 possibleConflicts.Add(symbolWithSection);
109 }
src/test/WixToolsetTest.CoreIntegration/RegistryFixture.cs
+26
@@ -79,6 +79,32 @@ namespace WixToolsetTest.CoreIntegration
79 }
80 }
81
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]
109 public void PopulatesRegistryTableFromRemoveRegistryKey()
110 {
src/test/WixToolsetTest.CoreIntegration/TestData/Registry/DuplicateRegistryValueIds.wxs new
+14
@@ -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>