aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Arnson <bob@firegiant.com>2025-04-09 11:00:59 -0400
committerBob Arnson <bob@firegiant.com>2025-04-09 11:00:59 -0400
commit0f2b73f28ff6b5df4af0731cd0abd2aca59293b8 (patch)
tree2fd1249ac7a129542a441ea47529fe885efdc1c7
parent8c7432e50072e009353ea5f2c956ccf453476f71 (diff)
downloadwix-bob/HarvestMultipleUnnamedBindPaths.tar.gz
wix-bob/HarvestMultipleUnnamedBindPaths.tar.bz2
wix-bob/HarvestMultipleUnnamedBindPaths.zip
Handle having multiple unnamed bind paths.bob/HarvestMultipleUnnamedBindPaths
Fixes https://github.com/wixtoolset/issues/issues/9028
-rw-r--r--src/wix/WixToolset.Core/HarvestFilesCommand.cs2
-rw-r--r--src/wix/test/WixToolsetTest.CoreIntegration/HarvestFilesFixture.cs13
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
206 206
207 if (String.IsNullOrEmpty(bindName)) 207 if (String.IsNullOrEmpty(bindName))
208 { 208 {
209 var unnamedBindPath = this.Context.BindPaths.SingleOrDefault(bp => bp.Name == null)?.Path; 209 var unnamedBindPath = this.Context.BindPaths.FirstOrDefault(bp => bp.Name == null)?.Path;
210 210
211 resultingDirectories.Add(unnamedBindPath is null ? path : Path.Combine(unnamedBindPath, path)); 211 resultingDirectories.Add(unnamedBindPath is null ? path : Path.Combine(unnamedBindPath, path));
212 } 212 }
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
317 @"flsu53T_9CcaBegDflAImGHTajDbJ0=PFiles\HarvestedFiles\unnamedfile.txt", 317 @"flsu53T_9CcaBegDflAImGHTajDbJ0=PFiles\HarvestedFiles\unnamedfile.txt",
318 }; 318 };
319 319
320 Build("BindPathsUnnamed.wxs", (msiPath, _) => AssertFileIdsAndTargetPaths(msiPath, expected), addUnnamedBindPath: true); 320 Build("BindPathsUnnamed.wxs", (msiPath, _) => AssertFileIdsAndTargetPaths(msiPath, expected), addUnnamedBindPaths: true);
321 } 321 }
322 322
323 [Fact] 323 [Fact]
@@ -423,12 +423,12 @@ namespace WixToolsetTest.CoreIntegration
423 WixAssert.CompareLineByLine(sortedExpected, actual); 423 WixAssert.CompareLineByLine(sortedExpected, actual);
424 } 424 }
425 425
426 private static void Build(string file, Action<string, WixRunnerResult> tester, bool isMsi = true, bool warningsAsErrors = true, bool addUnnamedBindPath = false, params string[] additionalCommandLineArguments) 426 private static void Build(string file, Action<string, WixRunnerResult> tester, bool isMsi = true, bool warningsAsErrors = true, bool addUnnamedBindPaths = false, params string[] additionalCommandLineArguments)
427 { 427 {
428 Build(file, (msiPath, sourceFolder, baseFolder, result) => tester(msiPath, result), isMsi, warningsAsErrors, addUnnamedBindPath, additionalCommandLineArguments); 428 Build(file, (msiPath, sourceFolder, baseFolder, result) => tester(msiPath, result), isMsi, warningsAsErrors, addUnnamedBindPaths, additionalCommandLineArguments);
429 } 429 }
430 430
431 private static void Build(string file, Action<string, string, string, WixRunnerResult> tester, bool isMsi = true, bool warningsAsErrors = true, bool addUnnamedBindPath = false, params string[] additionalCommandLineArguments) 431 private static void Build(string file, Action<string, string, string, WixRunnerResult> tester, bool isMsi = true, bool warningsAsErrors = true, bool addUnnamedBindPaths = false, params string[] additionalCommandLineArguments)
432 { 432 {
433 var sourceFolder = TestData.Get("TestData", "HarvestFiles"); 433 var sourceFolder = TestData.Get("TestData", "HarvestFiles");
434 434
@@ -449,10 +449,13 @@ namespace WixToolsetTest.CoreIntegration
449 "-o", msiPath, 449 "-o", msiPath,
450 }; 450 };
451 451
452 if (addUnnamedBindPath) 452 if (addUnnamedBindPaths)
453 { 453 {
454 arguments.Add("-bindpath"); 454 arguments.Add("-bindpath");
455 arguments.Add(Path.Combine(sourceFolder, "unnamedbindpath")); 455 arguments.Add(Path.Combine(sourceFolder, "unnamedbindpath"));
456
457 arguments.Add("-bindpath");
458 arguments.Add(Path.Combine(sourceFolder, "unnamedbindpath"));
456 } 459 }
457 460
458 if (additionalCommandLineArguments.Length > 0) 461 if (additionalCommandLineArguments.Length > 0)