From 0f2b73f28ff6b5df4af0731cd0abd2aca59293b8 Mon Sep 17 00:00:00 2001 From: Bob Arnson Date: Wed, 9 Apr 2025 11:00:59 -0400 Subject: Handle having multiple unnamed bind paths. Fixes https://github.com/wixtoolset/issues/issues/9028 --- src/wix/WixToolset.Core/HarvestFilesCommand.cs | 2 +- .../WixToolsetTest.CoreIntegration/HarvestFilesFixture.cs | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/wix/WixToolset.Core/HarvestFilesCommand.cs b/src/wix/WixToolset.Core/HarvestFilesCommand.cs index 25698ece..33c38589 100644 --- a/src/wix/WixToolset.Core/HarvestFilesCommand.cs +++ b/src/wix/WixToolset.Core/HarvestFilesCommand.cs @@ -206,7 +206,7 @@ namespace WixToolset.Core if (String.IsNullOrEmpty(bindName)) { - var unnamedBindPath = this.Context.BindPaths.SingleOrDefault(bp => bp.Name == null)?.Path; + var unnamedBindPath = this.Context.BindPaths.FirstOrDefault(bp => bp.Name == null)?.Path; resultingDirectories.Add(unnamedBindPath is null ? path : Path.Combine(unnamedBindPath, path)); } diff --git a/src/wix/test/WixToolsetTest.CoreIntegration/HarvestFilesFixture.cs b/src/wix/test/WixToolsetTest.CoreIntegration/HarvestFilesFixture.cs index a680d145..b407bb86 100644 --- a/src/wix/test/WixToolsetTest.CoreIntegration/HarvestFilesFixture.cs +++ b/src/wix/test/WixToolsetTest.CoreIntegration/HarvestFilesFixture.cs @@ -317,7 +317,7 @@ namespace WixToolsetTest.CoreIntegration @"flsu53T_9CcaBegDflAImGHTajDbJ0=PFiles\HarvestedFiles\unnamedfile.txt", }; - Build("BindPathsUnnamed.wxs", (msiPath, _) => AssertFileIdsAndTargetPaths(msiPath, expected), addUnnamedBindPath: true); + Build("BindPathsUnnamed.wxs", (msiPath, _) => AssertFileIdsAndTargetPaths(msiPath, expected), addUnnamedBindPaths: true); } [Fact] @@ -423,12 +423,12 @@ namespace WixToolsetTest.CoreIntegration WixAssert.CompareLineByLine(sortedExpected, actual); } - private static void Build(string file, Action tester, bool isMsi = true, bool warningsAsErrors = true, bool addUnnamedBindPath = false, params string[] additionalCommandLineArguments) + private static void Build(string file, Action tester, bool isMsi = true, bool warningsAsErrors = true, bool addUnnamedBindPaths = false, params string[] additionalCommandLineArguments) { - Build(file, (msiPath, sourceFolder, baseFolder, result) => tester(msiPath, result), isMsi, warningsAsErrors, addUnnamedBindPath, additionalCommandLineArguments); + Build(file, (msiPath, sourceFolder, baseFolder, result) => tester(msiPath, result), isMsi, warningsAsErrors, addUnnamedBindPaths, additionalCommandLineArguments); } - private static void Build(string file, Action tester, bool isMsi = true, bool warningsAsErrors = true, bool addUnnamedBindPath = false, params string[] additionalCommandLineArguments) + private static void Build(string file, Action tester, bool isMsi = true, bool warningsAsErrors = true, bool addUnnamedBindPaths = false, params string[] additionalCommandLineArguments) { var sourceFolder = TestData.Get("TestData", "HarvestFiles"); @@ -449,10 +449,13 @@ namespace WixToolsetTest.CoreIntegration "-o", msiPath, }; - if (addUnnamedBindPath) + if (addUnnamedBindPaths) { arguments.Add("-bindpath"); arguments.Add(Path.Combine(sourceFolder, "unnamedbindpath")); + + arguments.Add("-bindpath"); + arguments.Add(Path.Combine(sourceFolder, "unnamedbindpath")); } if (additionalCommandLineArguments.Length > 0) -- cgit v1.2.3-55-g6feb