From c8d8b48c87254f2b3932f169bd5e2783fb8fb627 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 31 Mar 2021 13:32:57 -0500 Subject: Fix regression where PayloadRefs for harvested payloads weren't created --- src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs | 1 + .../ContainerFixture.cs | 73 ++++++++++++++++++++++ 2 files changed, 74 insertions(+) diff --git a/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs b/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs index 4e07d598..ea8d33d0 100644 --- a/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs +++ b/src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs @@ -251,6 +251,7 @@ namespace WixToolset.Core.Burn // Reindex the payloads now that all the payloads (minus the manifest payloads that will be created later) // are present. payloadSymbols = section.Symbols.OfType().ToDictionary(t => t.Id.Id); + wixGroupSymbols = this.GetRequiredSymbols(); packagesPayloads = RecalculatePackagesPayloads(payloadSymbols, wixGroupSymbols); // Process the payloads that were added by processing the packages. diff --git a/src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs b/src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs index 0799cc24..e3dda59d 100644 --- a/src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs +++ b/src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs @@ -6,6 +6,7 @@ namespace WixToolsetTest.CoreIntegration using System.Collections.Generic; using System.IO; using System.Linq; + using System.Xml; using WixBuildTools.TestSupport; using WixToolset.Core.TestPackage; using WixToolset.Data; @@ -82,6 +83,78 @@ namespace WixToolsetTest.CoreIntegration } } + [Fact] + public void HarvestedPayloadsArePutInCorrectPackage() + { + var folder = TestData.Get(@"TestData"); + + using (var fs = new DisposableFileSystem()) + { + var baseFolder = fs.GetFolder(); + var intermediateFolder = Path.Combine(baseFolder, "obj"); + var binFolder = Path.Combine(baseFolder, "bin"); + var bundlePath = Path.Combine(binFolder, "test.exe"); + var baFolderPath = Path.Combine(baseFolder, "ba"); + var extractFolderPath = Path.Combine(baseFolder, "extract"); + + var result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "MsiTransaction", "FirstX86.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", Path.Combine(binFolder, "FirstX86.msi"), + }); + + result.AssertSuccess(); + + result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "MsiTransaction", "FirstX64.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"), + Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"), + "-bindpath", Path.Combine(folder, "SingleFile", "data"), + "-intermediateFolder", intermediateFolder, + "-o", Path.Combine(binFolder, "FirstX64.msi"), + }); + + result.AssertSuccess(); + + result = WixRunner.Execute(new[] + { + "build", + Path.Combine(folder, "Container", "HarvestIntoDetachedContainer.wxs"), + Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"), + "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), + "-bindpath", binFolder, + "-intermediateFolder", intermediateFolder, + "-o", bundlePath + }); + + result.AssertSuccess(); + + Assert.True(File.Exists(bundlePath)); + + var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath); + extractResult.AssertSuccess(); + + var payloads = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Chain/burn:MsiPackage/burn:PayloadRef") + .Cast() + .Select(e => e.GetTestXml()) + .ToArray(); + WixAssert.CompareLineByLine(new string[] + { + "", + "", + "", + "", + }, payloads); + } + } + [Fact(Skip = "https://github.com/wixtoolset/issues/issues/6144")] public void MultipleAttachedContainersAreNotCurrentlySupported() { -- cgit v1.2.3-55-g6feb