diff options
author | Rob Mensching <rob@firegiant.com> | 2021-04-10 15:04:04 -0700 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2021-04-12 10:24:01 -0700 |
commit | 3441afb46c4dc056493ab84f9b27434c4185d713 (patch) | |
tree | ec5d6b43292d34e256ebcbf6bf8795b4da46bc80 /src/test | |
parent | e7b745b08c51b173c80253432a82583e73c46157 (diff) | |
download | wix-3441afb46c4dc056493ab84f9b27434c4185d713.tar.gz wix-3441afb46c4dc056493ab84f9b27434c4185d713.tar.bz2 wix-3441afb46c4dc056493ab84f9b27434c4185d713.zip |
Improve implicit Component/@Id generation and duplicate GUID errors
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/ComponentFixture.cs | 45 | ||||
-rw-r--r-- | src/test/WixToolsetTest.CoreIntegration/TestData/Component/GuidCollision.wxs | 14 |
2 files changed, 59 insertions, 0 deletions
diff --git a/src/test/WixToolsetTest.CoreIntegration/ComponentFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ComponentFixture.cs new file mode 100644 index 00000000..d24ba08c --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/ComponentFixture.cs | |||
@@ -0,0 +1,45 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolsetTest.CoreIntegration | ||
4 | { | ||
5 | using System; | ||
6 | using System.IO; | ||
7 | using System.Linq; | ||
8 | using WixBuildTools.TestSupport; | ||
9 | using WixToolset.Core.TestPackage; | ||
10 | using WixToolset.Data; | ||
11 | using Xunit; | ||
12 | |||
13 | public class ComponentFixture | ||
14 | { | ||
15 | [Fact] | ||
16 | public void CanDetectDuplicateComponentGuids() | ||
17 | { | ||
18 | var folder = TestData.Get(@"TestData"); | ||
19 | |||
20 | using (var fs = new DisposableFileSystem()) | ||
21 | { | ||
22 | var baseFolder = fs.GetFolder(); | ||
23 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
24 | var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); | ||
25 | |||
26 | var result = WixRunner.Execute(new[] | ||
27 | { | ||
28 | "build", | ||
29 | Path.Combine(folder, "Component", "GuidCollision.wxs"), | ||
30 | Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), | ||
31 | "-bindpath", Path.Combine(folder, "SingleFile", "data"), | ||
32 | "-intermediateFolder", intermediateFolder, | ||
33 | "-o", msiPath | ||
34 | }); | ||
35 | |||
36 | var errors = result.Messages.Where(m => m.Level == MessageLevel.Error); | ||
37 | Array.Equals(new[] | ||
38 | { | ||
39 | 369, | ||
40 | 369 | ||
41 | }, errors.Select(e => e.Id).ToArray()); | ||
42 | } | ||
43 | } | ||
44 | } | ||
45 | } | ||
diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Component/GuidCollision.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Component/GuidCollision.wxs new file mode 100644 index 00000000..a0e921cb --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Component/GuidCollision.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 Guid="5917d193-7b5f-4d5d-bc2e-06aa210699cb"> | ||
6 | <RegistryValue Root="HKLM" Key="SOFTWARE\WixToolset" Name="Test" Value="test value" /> | ||
7 | </Component> | ||
8 | |||
9 | <Component Guid="5917d193-7b5f-4d5d-bc2e-06aa210699cb"> | ||
10 | <File Source="test.txt" /> | ||
11 | </Component> | ||
12 | </ComponentGroup> | ||
13 | </Fragment> | ||
14 | </Wix> | ||