From a2614e6e11108abba52b9eca8f460d9ab57513f5 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Mon, 3 Sep 2018 18:19:08 -0400 Subject: Warn on preprocessor variable redefinition only when the values are different. Fixes wixtoolset/issues#5853 --- .../PreprocessorFixture.cs | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs (limited to 'src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs') diff --git a/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs b/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs new file mode 100644 index 00000000..1193b685 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/PreprocessorFixture.cs @@ -0,0 +1,44 @@ +// 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.IO; + using System.Linq; + using WixBuildTools.TestSupport; + using WixToolset.Core.TestPackage; + using WixToolset.Data; + using WixToolset.Data.Tuples; + using WixToolset.Data.WindowsInstaller; + using Xunit; + + public class PreprocessorFixture + { + [Fact] + public void VariableRedefinitionIsAWarning() + { + var folder = TestData.Get(@"TestData\Variables"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "Package.wxs"), + Path.Combine(folder, "PackageComponents.wxs"), + "-loc", Path.Combine(folder, "Package.en-us.wxl"), + "-bindpath", Path.Combine(folder, "data"), + "-intermediateFolder", intermediateFolder, + "-o", Path.Combine(baseFolder, @"bin\test.msi") + }, out var messages); + Assert.Equal(0, result); + + var warnings = messages.Where(message => message.Id == 1118); + Assert.Single(warnings); + } + } + } +} + -- cgit v1.2.3-55-g6feb