From b62a7a0beb7ceb7987de28ec768c7814cadb83b9 Mon Sep 17 00:00:00 2001 From: Rob Mensching Date: Tue, 21 Jul 2020 14:31:53 -0700 Subject: Support implicit standard directory reference and "3264" platform folders Completes wixtoolset/issues#5798 and wixtoolset/issues#5835 --- .../DirectoryFixture.cs | 89 ++++++++++++++++++++++ .../MsiQueryFixture.cs | 7 +- .../TestData/CustomAction/SimpleCustomAction.wxs | 15 ++++ .../TestData/CustomTable/CustomTable-Expected.wxs | 12 +-- .../TestData/Directory/Empty.wxs | 6 ++ .../ProductWithComponentGroupRef/Product.wxs | 6 +- .../WixToolsetTest.CoreIntegration.csproj | 2 + 7 files changed, 124 insertions(+), 13 deletions(-) create mode 100644 src/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/CustomAction/SimpleCustomAction.wxs create mode 100644 src/test/WixToolsetTest.CoreIntegration/TestData/Directory/Empty.wxs (limited to 'src/test/WixToolsetTest.CoreIntegration') diff --git a/src/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs b/src/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs new file mode 100644 index 00000000..83f2f2bb --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/DirectoryFixture.cs @@ -0,0 +1,89 @@ +// 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 Xunit; + + public class DirectoryFixture + { + [Fact] + public void CanGet32bitProgramFiles6432Folder() + { + 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, "Directory", "Empty.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + result.AssertSuccess(); + + var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb")); + var section = intermediate.Sections.Single(); + + var dirSymbols = section.Symbols.OfType().ToList(); + Assert.Equal(new[] + { + "INSTALLFOLDER", + "ProgramFiles6432Folder", + "ProgramFilesFolder", + "TARGETDIR" + }, dirSymbols.Select(d => d.Id.Id).ToArray()); + } + } + + [Fact] + public void CanGet64bitProgramFiles6432Folder() + { + 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", + "-arch", "x64", + Path.Combine(folder, "Directory", "Empty.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", msiPath + }); + + result.AssertSuccess(); + + var intermediate = Intermediate.Load(Path.Combine(baseFolder, @"bin\test.wixpdb")); + var section = intermediate.Sections.Single(); + + var dirSymbols = section.Symbols.OfType().ToList(); + Assert.Equal(new[] + { + "INSTALLFOLDER", + "ProgramFiles6432Folder", + "ProgramFiles64Folder", + "TARGETDIR" + }, dirSymbols.Select(d => d.Id.Id).ToArray()); + } + } + } +} diff --git a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs index 3ab218d1..4ff7f5f6 100644 --- a/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/MsiQueryFixture.cs @@ -365,14 +365,15 @@ namespace WixToolsetTest.CoreIntegration Assert.True(File.Exists(msiPath)); var results = Query.QueryDatabase(msiPath, new[] { "Directory" }); - Assert.Equal(new[] + WixAssert.CompareLineByLine(new[] { "Directory:DUPLICATENAMEANDSHORTNAME\tINSTALLFOLDER\tduplicat", - "Directory:INSTALLFOLDER\tProgramFilesFolder\toekcr5lq|MsiPackage", + "Directory:INSTALLFOLDER\tProgramFiles6432Folder\t1egc1laj|MsiPackage", "Directory:NAMEANDSHORTNAME\tINSTALLFOLDER\tSHORTNAM|NameAndShortName", "Directory:NAMEANDSHORTSOURCENAME\tINSTALLFOLDER\tNAMEASSN|NameAndShortSourceName", "Directory:NAMEWITHSHORTVALUE\tINSTALLFOLDER\tSHORTVAL", - "Directory:ProgramFilesFolder\tTARGETDIR\t.", + "Directory:ProgramFiles6432Folder\tProgramFilesFolder\t.", + "Directory:ProgramFilesFolder\tTARGETDIR\tPFiles", "Directory:SHORTNAMEANDLONGSOURCENAME\tINSTALLFOLDER\tSHNALSNM:6ukthv5q|ShortNameAndLongSourceName", "Directory:SHORTNAMEONLY\tINSTALLFOLDER\tSHORTONL", "Directory:SOURCENAME\tINSTALLFOLDER\ts2s5bq-i|NameAndSourceName:dhnqygng|SourceNameWithName", diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/CustomAction/SimpleCustomAction.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomAction/SimpleCustomAction.wxs new file mode 100644 index 00000000..72d5e4a5 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomAction/SimpleCustomAction.wxs @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/CustomTable-Expected.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/CustomTable-Expected.wxs index 68386612..c55f4ed0 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/CustomTable-Expected.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/CustomTable/CustomTable-Expected.wxs @@ -15,11 +15,13 @@ - - - - - + + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/Directory/Empty.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/Directory/Empty.wxs new file mode 100644 index 00000000..50cf6850 --- /dev/null +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/Directory/Empty.wxs @@ -0,0 +1,6 @@ + + + + + + diff --git a/src/test/WixToolsetTest.CoreIntegration/TestData/ProductWithComponentGroupRef/Product.wxs b/src/test/WixToolsetTest.CoreIntegration/TestData/ProductWithComponentGroupRef/Product.wxs index b2f22b7d..5b26091a 100644 --- a/src/test/WixToolsetTest.CoreIntegration/TestData/ProductWithComponentGroupRef/Product.wxs +++ b/src/test/WixToolsetTest.CoreIntegration/TestData/ProductWithComponentGroupRef/Product.wxs @@ -11,10 +11,6 @@ - - - - - + diff --git a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj index 15078b8a..601a66e7 100644 --- a/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj +++ b/src/test/WixToolsetTest.CoreIntegration/WixToolsetTest.CoreIntegration.csproj @@ -36,6 +36,7 @@ + @@ -48,6 +49,7 @@ + -- cgit v1.2.3-55-g6feb