@joebigelow / wix-1 / commits / 2449385e

Support containers in relative subfolders

Fixes 5677

Rob Mensching committed Mar 14, 2022 at 11:13 UTC 2449385e7c649821907a745d3859137977b3e78a
3 files changed +45 -1
src/wix/WixToolset.Core.Burn/Bundles/CreateContainerCommand.cs
+3
@@ -45,6 +45,9 @@ namespace WixToolset.Core.Burn.Bundles
45 public void Execute()
46 {
47 var cabinetPath = Path.GetFullPath(this.OutputPath);
48 + var cabinetFolder = Path.GetDirectoryName(cabinetPath);
49 +
50 + Directory.CreateDirectory(cabinetFolder);
51
52 var files = new List<CabinetCompressFile>();
53
src/wix/test/WixToolsetTest.CoreIntegration/BundleFixture.cs
+30 -1
@@ -8,9 +8,9 @@ namespace WixToolsetTest.CoreIntegration
8 using System.Linq;
9 using System.Text;
10 using System.Xml;
11 + using System.Xml.Linq;
12 using Example.Extension;
13 using WixBuildTools.TestSupport;
13 - using WixToolset.Core;
14 using WixToolset.Core.Burn;
15 using WixToolset.Core.TestPackage;
16 using WixToolset.Data;
@@ -529,6 +529,35 @@ namespace WixToolsetTest.CoreIntegration
529 }
530 }
531
532 + [Fact]
533 + public void CantBuildWithSubfolderContainer()
534 + {
535 + var folder = TestData.Get(@"TestData");
536 +
537 + using (var fs = new DisposableFileSystem())
538 + {
539 + var baseFolder = fs.GetFolder();
540 + var intermediateFolder = Path.Combine(baseFolder, "obj");
541 + var exePath = Path.Combine(baseFolder, @"bin", "test.exe");
542 + var containerPath = Path.Combine(baseFolder, "bin", "Data", "c1");
543 +
544 + var result = WixRunner.Execute(new[]
545 + {
546 + "build",
547 + Path.Combine(folder, "Bundle", "SubfolderContainer.wxs"),
548 + Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"),
549 + "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
550 + "-bindpath", Path.Combine(folder, ".Data"),
551 + "-intermediateFolder", intermediateFolder,
552 + "-o", exePath,
553 + });
554 +
555 + result.AssertSuccess();
556 +
557 + Assert.True(File.Exists(containerPath), $"Failed to find external container: {containerPath}");
558 + }
559 + }
560 +
561 [Fact]
562 public void CantBuildWithUnscheduledPackage()
563 {
src/wix/test/WixToolsetTest.CoreIntegration/TestData/Bundle/SubfolderContainer.wxs new
+12
@@ -0,0 +1,12 @@
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
3 + <Fragment>
4 + <Container Name="Data\c1">
5 + <PackageGroupRef Id="BundlePackages" />
6 + </Container>
7 +
8 + <PackageGroup Id="BundlePackages">
9 + <MsiPackage SourceFile="test.msi" />
10 + </PackageGroup>
11 + </Fragment>
12 +</Wix>