Fix regression where PayloadRefs for harvested payloads weren't created
Sean Hall committed
Mar 31, 2021 at 13:32 UTC
c8d8b48c87254f2b3932f169bd5e2783fb8fb627
2 files changed
+74
src/WixToolset.Core.Burn/Bind/BindBundleCommand.cs
+1
@@ -251,6 +251,7 @@ namespace WixToolset.Core.Burn
251
// Reindex the payloads now that all the payloads (minus the manifest payloads that will be created later)
252
// are present.
253
payloadSymbols = section.Symbols.OfType<WixBundlePayloadSymbol>().ToDictionary(t => t.Id.Id);
254
+ wixGroupSymbols = this.GetRequiredSymbols<WixGroupSymbol>();
255
packagesPayloads = RecalculatePackagesPayloads(payloadSymbols, wixGroupSymbols);
256
257
// Process the payloads that were added by processing the packages.
src/test/WixToolsetTest.CoreIntegration/ContainerFixture.cs
+73
@@ -6,6 +6,7 @@ namespace WixToolsetTest.CoreIntegration
6
using System.Collections.Generic;
7
using System.IO;
8
using System.Linq;
9
+ using System.Xml;
10
using WixBuildTools.TestSupport;
11
using WixToolset.Core.TestPackage;
12
using WixToolset.Data;
@@ -82,6 +83,78 @@ namespace WixToolsetTest.CoreIntegration
83
}
84
}
85
86
+ [Fact]
87
+ public void HarvestedPayloadsArePutInCorrectPackage()
88
+ {
89
+ var folder = TestData.Get(@"TestData");
90
+
91
+ using (var fs = new DisposableFileSystem())
92
+ {
93
+ var baseFolder = fs.GetFolder();
94
+ var intermediateFolder = Path.Combine(baseFolder, "obj");
95
+ var binFolder = Path.Combine(baseFolder, "bin");
96
+ var bundlePath = Path.Combine(binFolder, "test.exe");
97
+ var baFolderPath = Path.Combine(baseFolder, "ba");
98
+ var extractFolderPath = Path.Combine(baseFolder, "extract");
99
+
100
+ var result = WixRunner.Execute(new[]
101
+ {
102
+ "build",
103
+ Path.Combine(folder, "MsiTransaction", "FirstX86.wxs"),
104
+ Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"),
105
+ Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
106
+ "-bindpath", Path.Combine(folder, "SingleFile", "data"),
107
+ "-intermediateFolder", intermediateFolder,
108
+ "-o", Path.Combine(binFolder, "FirstX86.msi"),
109
+ });
110
+
111
+ result.AssertSuccess();
112
+
113
+ result = WixRunner.Execute(new[]
114
+ {
115
+ "build",
116
+ Path.Combine(folder, "MsiTransaction", "FirstX64.wxs"),
117
+ Path.Combine(folder, "ProductWithComponentGroupRef", "MinimalComponentGroup.wxs"),
118
+ Path.Combine(folder, "ProductWithComponentGroupRef", "Product.wxs"),
119
+ "-bindpath", Path.Combine(folder, "SingleFile", "data"),
120
+ "-intermediateFolder", intermediateFolder,
121
+ "-o", Path.Combine(binFolder, "FirstX64.msi"),
122
+ });
123
+
124
+ result.AssertSuccess();
125
+
126
+ result = WixRunner.Execute(new[]
127
+ {
128
+ "build",
129
+ Path.Combine(folder, "Container", "HarvestIntoDetachedContainer.wxs"),
130
+ Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"),
131
+ "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
132
+ "-bindpath", binFolder,
133
+ "-intermediateFolder", intermediateFolder,
134
+ "-o", bundlePath
135
+ });
136
+
137
+ result.AssertSuccess();
138
+
139
+ Assert.True(File.Exists(bundlePath));
140
+
141
+ var extractResult = BundleExtractor.ExtractBAContainer(null, bundlePath, baFolderPath, extractFolderPath);
142
+ extractResult.AssertSuccess();
143
+
144
+ var payloads = extractResult.SelectManifestNodes("/burn:BurnManifest/burn:Chain/burn:MsiPackage/burn:PayloadRef")
145
+ .Cast<XmlElement>()
146
+ .Select(e => e.GetTestXml())
147
+ .ToArray();
148
+ WixAssert.CompareLineByLine(new string[]
149
+ {
150
+ "<PayloadRef Id='FirstX86.msi' />",
151
+ "<PayloadRef Id='fk1m38Cf9RZ2Bx_ipinRY6BftelU' />",
152
+ "<PayloadRef Id='FirstX64.msi' />",
153
+ "<PayloadRef Id='fC0n41rZK8oW3JK8LzHu6AT3CjdQ' />",
154
+ }, payloads);
155
+ }
156
+ }
157
+
158
[Fact(Skip = "https://github.com/wixtoolset/issues/issues/6144")]
159
public void MultipleAttachedContainersAreNotCurrentlySupported()
160
{