main
cs 539 lines 27.7 KB
Raw
1 // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3 namespace WixToolsetTest.CoreIntegration
4 {
5 using System;
6 using System.Collections.Generic;
7 using System.IO;
8 using System.Linq;
9 using WixInternal.TestSupport;
10 using WixInternal.Core.TestPackage;
11 using Xunit;
12
13 public class BurnRemotePayloadSubcommandFixture
14 {
15 [Fact]
16 public void CanGetRemoteBundlePayload()
17 {
18 var folder = TestData.Get(@"TestData");
19
20 using (var fs = new DisposableFileSystem())
21 {
22 var outputFolder = fs.GetFolder();
23 var intermediateFolder = Path.Combine(outputFolder, "obj");
24 var exePath = Path.Combine(outputFolder, @"bin\test.exe");
25
26 var result = WixRunner.Execute(new[]
27 {
28 "build",
29 Path.Combine(folder, "RemotePayload", "DiversePayloadsBundle.wxs"),
30 "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
31 "-bindpath", Path.Combine(folder, ".Data"),
32 "-intermediateFolder", intermediateFolder,
33 "-o", exePath,
34 });
35
36 result.AssertSuccess();
37
38 File.Copy(Path.Combine(folder, ".Data", "signed_bundle_engine.exe"), Path.Combine(outputFolder, "bin", "signed_bundle_engine.exe"));
39
40 // None
41 var noneOutFile = Path.Combine(outputFolder, "none_out.xml");
42
43 result = WixRunner.Execute(new[]
44 {
45 "burn", "remotepayload",
46 exePath,
47 "-o", noneOutFile,
48 "-packagetype", "bundle",
49 "-bundlepayloadgeneration", "none",
50 });
51
52 result.AssertSuccess();
53
54 var xml = File.ReadAllText(noneOutFile);
55 var ignoreAttributesByElementName = new Dictionary<string, List<string>>
56 {
57 { "BundlePackagePayload", new List<string> { "Size", "Hash" } },
58 { "RemoteBundle", new List<string> { "BundleId", "EngineVersion", "ProviderKey" } },
59 { "Payload", new List<string> { "Size", "Hash" } },
60 };
61 WixAssert.StringEqual(
62 "<BundlePackage>" +
63 "<BundlePackagePayload Name='test.exe' ProductName='DiversePayloadsBundle' Description='DiversePayloadsBundle' Hash='*' Size='*' Version='1.0.0.0'>" +
64 "<RemoteBundle BundleId='*' DisplayName='DiversePayloadsBundle' EngineVersion='*' InstallSize='3790116' ManifestNamespace='http://wixtoolset.org/schemas/v4/2008/Burn' PerMachine='yes' ProviderKey='*' ProtocolVersion='1' Version='1.0.0.0' Win64='no' UpgradeCode='{FEF1D2B8-4737-4A2A-9F91-77F7294FB55B}' />" +
65 "</BundlePackagePayload>" +
66 "</BundlePackage>", xml.GetTestXml(ignoreAttributesByElementName));
67
68 // ExternalWithoutDownloadUrl
69 var externalWithoutDownloadUrlOutFile = Path.Combine(outputFolder, "externalWithoutDownloadUrl_out.xml");
70
71 result = WixRunner.Execute(new[]
72 {
73 "burn", "remotepayload",
74 exePath,
75 "-o", externalWithoutDownloadUrlOutFile,
76 "-packagetype", "bundle",
77 "-bundlepayloadgeneration", "externalWithoutDownloadUrl",
78 });
79
80 result.AssertSuccess();
81
82 xml = File.ReadAllText(externalWithoutDownloadUrlOutFile);
83 WixAssert.StringEqual(
84 "<BundlePackage>" +
85 "<BundlePackagePayload Name='test.exe' ProductName='DiversePayloadsBundle' Description='DiversePayloadsBundle' Hash='*' Size='*' Version='1.0.0.0'>" +
86 "<RemoteBundle BundleId='*' DisplayName='DiversePayloadsBundle' EngineVersion='*' InstallSize='3790116' ManifestNamespace='http://wixtoolset.org/schemas/v4/2008/Burn' PerMachine='yes' ProviderKey='*' ProtocolVersion='1' Version='1.0.0.0' Win64='no' UpgradeCode='{FEF1D2B8-4737-4A2A-9F91-77F7294FB55B}' />" +
87 "</BundlePackagePayload>" +
88 "<Payload Name='External.cab' Hash='*' Size='*' />" +
89 "<Payload Name='test.msi' Hash='*' Size='*' />" +
90 "<Payload Name='test.txt' Hash='*' Size='*' />" +
91 "<Payload Name='Shared.dll' Hash='*' Size='*' />" +
92 "</BundlePackage>", xml.GetTestXml(ignoreAttributesByElementName));
93
94 // External
95 var externalOutFile = Path.Combine(outputFolder, "external_out.xml");
96
97 result = WixRunner.Execute(new[]
98 {
99 "burn", "remotepayload",
100 exePath,
101 "-o", externalOutFile,
102 "-packagetype", "bundle",
103 "-bundlepayloadgeneration", "external",
104 });
105
106 result.AssertSuccess();
107
108 xml = File.ReadAllText(externalOutFile);
109 WixAssert.StringEqual(
110 "<BundlePackage>" +
111 "<BundlePackagePayload Name='test.exe' ProductName='DiversePayloadsBundle' Description='DiversePayloadsBundle' Hash='*' Size='*' Version='1.0.0.0'>" +
112 "<RemoteBundle BundleId='*' DisplayName='DiversePayloadsBundle' EngineVersion='*' InstallSize='3790116' ManifestNamespace='http://wixtoolset.org/schemas/v4/2008/Burn' PerMachine='yes' ProviderKey='*' ProtocolVersion='1' Version='1.0.0.0' Win64='no' UpgradeCode='{FEF1D2B8-4737-4A2A-9F91-77F7294FB55B}' />" +
113 "</BundlePackagePayload>" +
114 "<Payload Name='External.cab' Hash='*' Size='*' />" +
115 "<Payload Name='Windows8.1-KB2937592-x86.msu' Hash='*' Size='*' />" +
116 "<Payload Name='test.msi' Hash='*' Size='*' />" +
117 "<Payload Name='test.txt' Hash='*' Size='*' />" +
118 "<Payload Name='Shared.dll' Hash='*' Size='*' />" +
119 "</BundlePackage>", xml.GetTestXml(ignoreAttributesByElementName));
120
121 // All
122 var allOutFile = Path.Combine(outputFolder, "all_out.xml");
123
124 result = WixRunner.Execute(new[]
125 {
126 "burn", "remotepayload",
127 exePath,
128 "-o", allOutFile,
129 "-packagetype", "bundle",
130 "-bundlepayloadgeneration", "all",
131 });
132
133 result.AssertSuccess();
134
135 xml = File.ReadAllText(allOutFile);
136 WixAssert.StringEqual(
137 "<BundlePackage>" +
138 "<BundlePackagePayload Name='test.exe' ProductName='DiversePayloadsBundle' Description='DiversePayloadsBundle' Hash='*' Size='*' Version='1.0.0.0'>" +
139 "<RemoteBundle BundleId='*' DisplayName='DiversePayloadsBundle' EngineVersion='*' InstallSize='3790116' ManifestNamespace='http://wixtoolset.org/schemas/v4/2008/Burn' PerMachine='yes' ProviderKey='*' ProtocolVersion='1' Version='1.0.0.0' Win64='no' UpgradeCode='{FEF1D2B8-4737-4A2A-9F91-77F7294FB55B}' />" +
140 "</BundlePackagePayload>" +
141 "<Payload Name='External.cab' Hash='*' Size='*' />" +
142 "<Payload Name='signed_bundle_engine.exe' ProductName='~TestBundle' Description='~TestBundle' Hash='*' Size='*' Version='1.0.0.0' />" +
143 "<Payload Name='Windows8.1-KB2937592-x86.msu' Hash='*' Size='*' />" +
144 "<Payload Name='test.msi' Hash='*' Size='*' />" +
145 "<Payload Name='test.txt' Hash='*' Size='*' />" +
146 "<Payload Name='Shared.dll' Hash='*' Size='*' />" +
147 "</BundlePackage>", xml.GetTestXml(ignoreAttributesByElementName));
148 }
149 }
150
151 [Fact]
152 public void CanGetRemoteBundlePayloadWithCertificate()
153 {
154 var folder = TestData.Get(@"TestData");
155
156 using (var fs = new DisposableFileSystem())
157 {
158 var outputFolder = fs.GetFolder();
159 var outFile = Path.Combine(outputFolder, "out.xml");
160 var remotePayloadSourceFile = Path.Combine(outputFolder, "remotePayload.wxs");
161 var intermediateFolder = Path.Combine(outputFolder, "obj");
162 var bundleFile = Path.Combine(intermediateFolder, "out.exe");
163 var baFolderPath = Path.Combine(outputFolder, "ba");
164 var extractFolderPath = Path.Combine(outputFolder, "extract");
165
166 var result = WixRunner.Execute(new[]
167 {
168 "burn", "remotepayload",
169 "-usecertificate",
170 "-downloadUrl", "http://wixtoolset.org/{0}",
171 Path.Combine(folder, ".Data", "signed_wix314_4118_engine.exe"),
172 "-o", outFile,
173 "-packagetype", "bundle",
174 });
175
176 result.AssertSuccess();
177
178 var elements = File.ReadAllLines(outFile);
179 elements = elements.Select(s => s.Replace("\"", "'")).ToArray();
180
181 WixAssert.CompareLineByLine(new[]
182 {
183 @"<BundlePackage Visible='yes' CacheId='{C0BA713B-9CFE-42DF-B92C-883F6846B4BA}v3.14.0.4118C95FC39334E667F3DD3D'>",
184 @" <BundlePackagePayload Name='signed_wix314_4118_engine.exe' ProductName='WiX Toolset v3.14.0.4118' Description='WiX Toolset v3.14.0.4118' DownloadUrl='http://wixtoolset.org/{0}' CertificatePublicKey='03169B5A32E602D436FC14EC14C435D7309945D4' CertificateThumbprint='C95FC39334E667F3DD3D82AF382E05719B88F7C1' Size='1088640' Version='3.14.0.4118'>",
185 @" <RemoteBundle BundleId='{C0BA713B-9CFE-42DF-B92C-883F6846B4BA}' DisplayName='WiX Toolset v3.14.0.4118' InstallSize='188426175' ManifestNamespace='http://schemas.microsoft.com/wix/2008/Burn' PerMachine='yes' ProviderKey='{c0ba713b-9cfe-42df-b92c-883f6846b4ba}' ProtocolVersion='1' Version='3.14.0.4118' Win64='no' UpgradeCode='{65E893AD-EDD5-4E7D-80CA-F0F50F383532}' />",
186 @" </BundlePackagePayload>",
187 @"</BundlePackage>",
188 }, elements);
189
190 var remotePayloadSourceText = "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>" +
191 " <Fragment>" +
192 " <PackageGroup Id='BundlePackages'>" +
193 String.Join(Environment.NewLine, elements) +
194 " </PackageGroup>" +
195 " </Fragment>" +
196 "</Wix>";
197
198 File.WriteAllText(remotePayloadSourceFile, remotePayloadSourceText);
199
200 result = WixRunner.Execute(new[]
201 {
202 "build",
203 Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"),
204 remotePayloadSourceFile,
205 "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
206 "-bindpath", Path.Combine(folder, ".Data"),
207 "-intermediateFolder", intermediateFolder,
208 "-o", bundleFile
209 });
210
211 result.AssertSuccess();
212
213 var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath);
214 extractResult.AssertSuccess();
215
216 var msuPackages = extractResult.GetManifestTestXmlLines("/burn:BurnManifest/burn:Chain/burn:BundlePackage");
217 WixAssert.CompareLineByLine(new string[]
218 {
219 "<BundlePackage Id='signed_wix314_4118_engine.exe' Cache='keep' CacheId='{C0BA713B-9CFE-42DF-B92C-883F6846B4BA}v3.14.0.4118C95FC39334E667F3DD3D' InstallSize='188426175' Size='1088640' PerMachine='yes' Permanent='no' Vital='yes' RollbackBoundaryForward='WixDefaultBoundary' RollbackBoundaryBackward='WixDefaultBoundary' LogPathVariable='WixBundleLog_signed_wix314_4118_engine.exe' RollbackLogPathVariable='WixBundleRollbackLog_signed_wix314_4118_engine.exe' BundleId='{C0BA713B-9CFE-42DF-B92C-883F6846B4BA}' Version='3.14.0.4118' InstallArguments='' UninstallArguments='' RepairArguments='' SupportsBurnProtocol='yes' Win64='no'>" +
220 "<Provides Key='{c0ba713b-9cfe-42df-b92c-883f6846b4ba}' Version='3.14.0.4118' DisplayName='WiX Toolset v3.14.0.4118' Imported='yes' />" +
221 "<RelatedBundle Id='{65E893AD-EDD5-4E7D-80CA-F0F50F383532}' Action='Upgrade' />" +
222 "<PayloadRef Id='signed_wix314_4118_engine.exe' />" +
223 "</BundlePackage>",
224 }, msuPackages);
225 }
226 }
227
228 [Fact]
229 public void CanGetRemoteV3BundlePayload()
230 {
231 var folder = TestData.Get(@"TestData");
232
233 using (var fs = new DisposableFileSystem())
234 {
235 var outputFolder = fs.GetFolder();
236 var outFile = Path.Combine(outputFolder, "out.xml");
237
238 var result = WixRunner.Execute(new[]
239 {
240 "burn", "remotepayload",
241 Path.Combine(folder, ".Data", "v3bundle.exe"),
242 "-downloadurl", "https://www.example.com/files/{0}",
243 "-o", outFile,
244 "-packagetype", "bundle",
245 });
246
247 result.AssertSuccess();
248
249 var elements = File.ReadAllLines(outFile);
250 elements = elements.Select(s => s.Replace("\"", "'")).ToArray();
251
252 WixAssert.CompareLineByLine(new[]
253 {
254 "<BundlePackage Visible='yes'>",
255 " <BundlePackagePayload Name='v3bundle.exe' ProductName='CustomV3Theme' Description='CustomV3Theme' DownloadUrl='https://www.example.com/files/{0}' Hash='80739E7B8C31D75B4CDC48D60D74F5E481CB904212A3AE3FB0920365A163FBF32B0C5C175AB516D4124F107923E96200605DE1D560D362FEB47350FA727823B4' Size='648397' Version='1.0.0.0'>",
256 " <RemoteBundle BundleId='{215A70DB-AB35-48C7-BE51-D66EAAC87177}' DisplayName='CustomV3Theme' InstallSize='1135' ManifestNamespace='http://schemas.microsoft.com/wix/2008/Burn' PerMachine='yes' ProviderKey='{215a70db-ab35-48c7-be51-d66eaac87177}' ProtocolVersion='1' Version='1.0.0.0' Win64='no' UpgradeCode='{2BF4C01F-C132-4E70-97AB-2BC68C7CCD10}' />",
257 " </BundlePackagePayload>",
258 "</BundlePackage>",
259 }, elements);
260 }
261 }
262
263 [Fact]
264 public void CanGetRemoteExePayload()
265 {
266 var folder = TestData.Get(@"TestData");
267
268 using (var fs = new DisposableFileSystem())
269 {
270 var outputFolder = fs.GetFolder();
271 var outFile = Path.Combine(outputFolder, "out.xml");
272
273 var result = WixRunner.Execute(new[]
274 {
275 "burn", "remotepayload",
276 Path.Combine(folder, ".Data", "burn.exe"),
277 "-downloadurl", "https://www.example.com/files/{0}",
278 "-o", outFile
279 });
280
281 result.AssertSuccess();
282
283 var elements = File.ReadAllLines(outFile);
284 elements = elements.Select(s => s.Replace("\"", "'")).ToArray();
285
286 WixAssert.CompareLineByLine(new[]
287 {
288 @"<ExePackage>",
289 @" <ExePackagePayload Name='burn.exe' ProductName='Windows Installer XML Toolset' Description='WiX Toolset Bootstrapper' DownloadUrl='https://www.example.com/files/{0}' Hash='F6E722518AC3AB7E31C70099368D5770788C179AA23226110DCF07319B1E1964E246A1E8AE72E2CF23E0138AFC281BAFDE45969204405E114EB20C8195DA7E5E' Size='463360' Version='3.14.0.1703' />",
290 @"</ExePackage>",
291 }, elements);
292 }
293 }
294
295 [Fact]
296 public void CanGetRemoteMsuPayload()
297 {
298 var folder = TestData.Get(@"TestData");
299
300 using (var fs = new DisposableFileSystem())
301 {
302 var outputFolder = fs.GetFolder();
303 var outFile = Path.Combine(outputFolder, "out.xml");
304
305 var result = WixRunner.Execute(new[]
306 {
307 "burn", "remotepayload",
308 Path.Combine(folder, ".Data", "Windows8.1-KB2937592-x86.msu"),
309 "-o", outFile
310 });
311
312 result.AssertSuccess();
313
314 var elements = File.ReadAllLines(outFile);
315 elements = elements.Select(s => s.Replace("\"", "'")).ToArray();
316
317 WixAssert.CompareLineByLine(new[]
318 {
319 @"<MsuPackage>",
320 @" <MsuPackagePayload Name='Windows8.1-KB2937592-x86.msu' Hash='904ADEA6AB675ACE16483138BF3F5850FD56ACB6E3A13AFA7263ED49C68CCE6CF84D6AAD6F99AAF175A95EE1A56C787C5AD968019056490B1073E7DBB7B9B7BE' Size='309544' />",
321 @"</MsuPackage>"
322 }, elements);
323 }
324 }
325
326 [Fact]
327 public void CanGetRemoteMsuPayloadWithCertificate()
328 {
329 var folder = TestData.Get(@"TestData");
330
331 using (var fs = new DisposableFileSystem())
332 {
333 var outputFolder = fs.GetFolder();
334 var outFile = Path.Combine(outputFolder, "out.xml");
335 var remotePayloadSourceFile = Path.Combine(outputFolder, "remotePayload.wxs");
336 var intermediateFolder = Path.Combine(outputFolder, "obj");
337 var bundleFile = Path.Combine(intermediateFolder, "out.exe");
338 var baFolderPath = Path.Combine(outputFolder, "ba");
339 var extractFolderPath = Path.Combine(outputFolder, "extract");
340
341 var result = WixRunner.Execute(new[]
342 {
343 "burn", "remotepayload",
344 "-usecertificate",
345 "-downloadUrl", "http://wixtoolset.org/{0}",
346 Path.Combine(folder, ".Data", "Windows8.1-KB2937592-x86.msu"),
347 "-o", outFile
348 });
349
350 result.AssertSuccess();
351
352 var elements = File.ReadAllLines(outFile);
353 elements = elements.Select(s => s.Replace("\"", "'")).ToArray();
354
355 WixAssert.CompareLineByLine(new[]
356 {
357 @"<MsuPackage CacheId='904ADEA6AB675ACE16483138BF3F5850FD56ACB6E3A1108E2BA23632620C427C'>",
358 @" <MsuPackagePayload Name='Windows8.1-KB2937592-x86.msu' DownloadUrl='http://wixtoolset.org/{0}' CertificatePublicKey='A260A870BE1145ED71E2BB5AA19463A4FE9DCC41' CertificateThumbprint='108E2BA23632620C427C570B6D9DB51AC31387FE' Size='309544' />",
359 @"</MsuPackage>"
360 }, elements);
361
362 // Append required attributes to build.
363 elements[0] = elements[0].Replace(">", " DetectCondition='test'>");
364
365 var remotePayloadSourceText = "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>" +
366 " <Fragment>" +
367 " <PackageGroup Id='BundlePackages'>" +
368 String.Join(Environment.NewLine, elements) +
369 " </PackageGroup>" +
370 " </Fragment>" +
371 "</Wix>";
372
373 File.WriteAllText(remotePayloadSourceFile, remotePayloadSourceText);
374
375 result = WixRunner.Execute(new[]
376 {
377 "build",
378 Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"),
379 remotePayloadSourceFile,
380 "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
381 "-bindpath", Path.Combine(folder, ".Data"),
382 "-intermediateFolder", intermediateFolder,
383 "-o", bundleFile
384 });
385
386 result.AssertSuccess();
387
388 var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath);
389 extractResult.AssertSuccess();
390
391 var msuPackages = extractResult.GetManifestTestXmlLines("/burn:BurnManifest/burn:Chain/burn:MsuPackage");
392 WixAssert.CompareLineByLine(new string[]
393 {
394 "<MsuPackage Id='Windows8.1_KB2937592_x86.msu' Cache='keep' CacheId='904ADEA6AB675ACE16483138BF3F5850FD56ACB6E3A1108E2BA23632620C427C' InstallSize='309544' Size='309544' PerMachine='yes' Permanent='no' Vital='yes' RollbackBoundaryForward='WixDefaultBoundary' RollbackBoundaryBackward='WixDefaultBoundary' DetectCondition='test'>" +
395 "<PayloadRef Id='Windows8.1_KB2937592_x86.msu' />" +
396 "</MsuPackage>",
397 }, msuPackages);
398 }
399 }
400
401 [Fact]
402 public void CanGetRemotePayloadWithCertificate()
403 {
404 var folder = TestData.Get(@"TestData");
405
406 using (var fs = new DisposableFileSystem())
407 {
408 var outputFolder = fs.GetFolder();
409 var outFile = Path.Combine(outputFolder, "out.xml");
410 var remotePayloadSourceFile = Path.Combine(outputFolder, "remotePayload.wxs");
411 var intermediateFolder = Path.Combine(outputFolder, "obj");
412 var bundleFile = Path.Combine(intermediateFolder, "out.exe");
413 var baFolderPath = Path.Combine(outputFolder, "ba");
414 var extractFolderPath = Path.Combine(outputFolder, "extract");
415
416 var result = WixRunner.Execute(new[]
417 {
418 "burn", "remotepayload",
419 "-usecertificate",
420 "-downloadUrl", "http://wixtoolset.org/{0}",
421 Path.Combine(folder, ".Data", "burn.exe"),
422 Path.Combine(folder, ".Data", "signed_cab1.cab"),
423 "-o", outFile
424 });
425
426 result.AssertSuccess();
427
428 var elements = File.ReadAllLines(outFile);
429 elements = elements.Select(s => s.Replace("\"", "'")).ToArray();
430
431 WixAssert.CompareLineByLine(new[]
432 {
433 @"<ExePackage>",
434 @" <ExePackagePayload Name='burn.exe' ProductName='Windows Installer XML Toolset' Description='WiX Toolset Bootstrapper' DownloadUrl='http://wixtoolset.org/{0}' Hash='F6E722518AC3AB7E31C70099368D5770788C179AA23226110DCF07319B1E1964E246A1E8AE72E2CF23E0138AFC281BAFDE45969204405E114EB20C8195DA7E5E' Size='463360' Version='3.14.0.1703' />",
435 @" <Payload Name='signed_cab1.cab' DownloadUrl='http://wixtoolset.org/{0}' CertificatePublicKey='BBD1B48A37503767C71F455624967D406A5D66C3' CertificateThumbprint='DE13B4CE635E3F63AA2394E66F95C460267BC82F' Size='1585' />",
436 @"</ExePackage>",
437 }, elements);
438
439 elements[0] = elements[0].Replace(">", " Permanent='yes' DetectCondition='test'>");
440
441 var remotePayloadSourceText = "<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>" +
442 " <Fragment>" +
443 " <PackageGroup Id='BundlePackages'>" +
444 String.Join(Environment.NewLine, elements) +
445 " </PackageGroup>" +
446 " </Fragment>" +
447 "</Wix>";
448
449 File.WriteAllText(remotePayloadSourceFile, remotePayloadSourceText);
450
451 result = WixRunner.Execute(new[]
452 {
453 "build",
454 Path.Combine(folder, "BundleWithPackageGroupRef", "Bundle.wxs"),
455 remotePayloadSourceFile,
456 "-bindpath", Path.Combine(folder, "SimpleBundle", "data"),
457 "-bindpath", Path.Combine(folder, ".Data"),
458 "-intermediateFolder", intermediateFolder,
459 "-o", bundleFile
460 });
461
462 result.AssertSuccess();
463 }
464 }
465
466 [Fact]
467 public void CanGetRemotePayloadWithoutCertificate()
468 {
469 var folder = TestData.Get(@"TestData");
470
471 using (var fs = new DisposableFileSystem())
472 {
473 var outputFolder = fs.GetFolder();
474 var outFile = Path.Combine(outputFolder, "out.xml");
475
476 var result = WixRunner.Execute(new[]
477 {
478 "burn", "remotepayload",
479 Path.Combine(folder, ".Data", "burn.exe"),
480 Path.Combine(folder, ".Data", "signed_cab1.cab"),
481 "-o", outFile
482 });
483
484 result.AssertSuccess();
485
486 var elements = File.ReadAllLines(outFile);
487 elements = elements.Select(s => s.Replace("\"", "'")).ToArray();
488
489 WixAssert.CompareLineByLine(new[]
490 {
491 @"<ExePackage>",
492 @" <ExePackagePayload Name='burn.exe' ProductName='Windows Installer XML Toolset' Description='WiX Toolset Bootstrapper' Hash='F6E722518AC3AB7E31C70099368D5770788C179AA23226110DCF07319B1E1964E246A1E8AE72E2CF23E0138AFC281BAFDE45969204405E114EB20C8195DA7E5E' Size='463360' Version='3.14.0.1703' />",
493 @" <Payload Name='signed_cab1.cab' Hash='D8D3842403710E1F6036A62543224855CADF546853933C2B17BA99D789D4347B36717687C022678A9D3DE749DFC1482DAAB92B997B62BB32A8A6828B9D04C414' Size='1585' />",
494 @"</ExePackage>",
495 }, elements);
496 }
497 }
498
499 [Fact]
500 public void CanGetRemotePayloadsRecursive()
501 {
502 var folder = TestData.Get(@"TestData");
503
504 using (var fs = new DisposableFileSystem())
505 {
506 var outputFolder = fs.GetFolder();
507 var outFile = Path.Combine(outputFolder, "out.xml");
508
509 var result = WixRunner.Execute(new[]
510 {
511 "burn", "remotepayload",
512 "-recurse",
513 "-du", "https://www.example.com/files/{0}",
514 Path.Combine(folder, ".Data", "burn.exe"),
515 Path.Combine(folder, "RemotePayload", "recurse", "*"),
516 "-basepath", Path.Combine(folder, "RemotePayload", "recurse"),
517 "-basepath", folder,
518 "-bp", Path.Combine(folder, ".Data"),
519 "-o", outFile
520 });
521
522 result.AssertSuccess();
523
524 var elements = File.ReadAllLines(outFile);
525 elements = elements.Select(s => s.Replace("\"", "'")).ToArray();
526
527 WixAssert.CompareLineByLine(new[]
528 {
529 @"<ExePackage>",
530 @" <ExePackagePayload Name='burn.exe' ProductName='Windows Installer XML Toolset' Description='WiX Toolset Bootstrapper' DownloadUrl='https://www.example.com/files/{0}' Hash='F6E722518AC3AB7E31C70099368D5770788C179AA23226110DCF07319B1E1964E246A1E8AE72E2CF23E0138AFC281BAFDE45969204405E114EB20C8195DA7E5E' Size='463360' Version='3.14.0.1703' />",
531 @" <Payload Name='a.dat' DownloadUrl='https://www.example.com/files/{0}' Hash='D13926E5CBE5ED8B46133F9199FAF2FF25B25981C67A31AE2BC3F6C20390FACBFADCD89BD22D3445D95B989C8EACFB1E68DB634BECB5C9624865BA453BCE362A' Size='16' />",
532 @" <Payload Name='subfolder\b.dat' DownloadUrl='https://www.example.com/files/{0}' Hash='5F94707BC29ADFE3B9615E6753388707FD0B8F5FD9EEEC2B17E21E72F1635FF7D7A101E7D14F614E111F263CB9AC4D0940BE1247881A7844F226D6C400293D8E' Size='37' />",
533 @" <Payload Name='subfolder\c.dat' DownloadUrl='https://www.example.com/files/{0}' Hash='97D6209A5571E05E4F72F9C6BF0987651FA03E63F971F9B53C2B3D798A666D9864F232D4E2D6442E47D9D72B282309B6EEFF4EE017B43B706FA92A0F5EF74734' Size='42' />",
534 @"</ExePackage>"
535 }, elements);
536 }
537 }
538 }
539 }