From 3441afb46c4dc056493ab84f9b27434c4185d713 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Sat, 10 Apr 2021 15:04:04 -0700 Subject: Improve implicit Component/@Id generation and duplicate GUID errors --- .../ComponentFixture.cs | 45 ++++++++++++++++++++++ .../TestData/Component/GuidCollision.wxs | 14 +++++++ 2 files changed, 59 insertions(+) create mode 100644 src/test/WixToolsetTest.CoreIntegration/ComponentFixture.cs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/Component/GuidCollision.wxs (limited to 'src/test') 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 @@ +// 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. + +namespace WixToolsetTest.CoreIntegration +{ + using System; + using System.IO; + using System.Linq; + using WixBuildTools.TestSupport; + using WixToolset.Core.TestPackage; + using WixToolset.Data; + using Xunit; + + public class ComponentFixture + { + [Fact] + public void CanDetectDuplicateComponentGuids() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var msiPath = Path.Combine(baseFolder, @"bin\test.msi"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "Component", "GuidCollision.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + var errors = result.Messages.Where(m => m.Level == MessageLevel.Error); + Array.Equals(new[] + { + 369, + 369 + }, errors.Select(e => e.Id).ToArray()); + } + } + } +} 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 @@ + + + + + + + + + + + + + + -- cgit v1.2.3-55-g6feb