| 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.IO; |
| 6 | using System.Linq; |
| 7 | using WixInternal.Core.TestPackage; |
| 8 | using WixInternal.TestSupport; |
| 9 | using Xunit; |
| 10 | |
| 11 | public class BundleBackwardsCompatibleFixture |
| 12 | { |
| 13 | [Fact] |
| 14 | public void CanBuildBundleWithBootstrapperApplicationDll() |
| 15 | { |
| 16 | var folder = TestData.Get(@"TestData"); |
| 17 | |
| 18 | using (var fs = new DisposableFileSystem()) |
| 19 | { |
| 20 | var baseFolder = fs.GetFolder(); |
| 21 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
| 22 | var exePath = Path.Combine(baseFolder, @"bin", "test.exe"); |
| 23 | |
| 24 | var result = WixRunner.Execute(warningsAsErrors: false, new[] |
| 25 | { |
| 26 | "build", |
| 27 | Path.Combine(folder, "BundleBackwardsCompatible", "BundleWithBootstrapperApplicationDll.wxs"), |
| 28 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), |
| 29 | "-bindpath", Path.Combine(folder, ".Data"), |
| 30 | "-intermediateFolder", intermediateFolder, |
| 31 | "-o", exePath, |
| 32 | }); |
| 33 | |
| 34 | result.AssertSuccess(); |
| 35 | |
| 36 | var messages = result.Messages.Select(WixMessageFormatter.FormatMessage).ToArray(); |
| 37 | WixAssert.CompareLineByLine(new[] |
| 38 | { |
| 39 | "Warning 1130: The BootstrapperApplicationDll element has been deprecated.", |
| 40 | }, messages); |
| 41 | |
| 42 | Assert.True(File.Exists(exePath)); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | [Fact] |
| 47 | public void CannotBuildBundleWithBootstrapperApplicationSourceAndBootstrapperApplicationDll() |
| 48 | { |
| 49 | var folder = TestData.Get(@"TestData"); |
| 50 | |
| 51 | using (var fs = new DisposableFileSystem()) |
| 52 | { |
| 53 | var baseFolder = fs.GetFolder(); |
| 54 | var intermediateFolder = Path.Combine(baseFolder, "obj"); |
| 55 | var exePath = Path.Combine(baseFolder, @"bin", "test.exe"); |
| 56 | |
| 57 | var result = WixRunner.Execute(warningsAsErrors: false, new[] |
| 58 | { |
| 59 | "build", |
| 60 | Path.Combine(folder, "BundleBackwardsCompatible", "BundleWithBootstrapperApplicationSourceAndBootstrapperApplicationDll.wxs"), |
| 61 | "-bindpath", Path.Combine(folder, "SimpleBundle", "data"), |
| 62 | "-bindpath", Path.Combine(folder, ".Data"), |
| 63 | "-intermediateFolder", intermediateFolder, |
| 64 | "-o", exePath, |
| 65 | }); |
| 66 | |
| 67 | var messages = result.Messages.Select(m => WixMessageFormatter.FormatMessage(m, folder, "<testdata>")).ToArray(); |
| 68 | |
| 69 | WixAssert.CompareLineByLine(new[] |
| 70 | { |
| 71 | "Warning 1130: The BootstrapperApplicationDll element has been deprecated.", |
| 72 | "Error 6604: More than one BootstrapperApplication source file was specified. Only one is allowed. Another BootstrapperApplication source file was defined via the BootstrapperApplication element at <testdata>\\BundleBackwardsCompatible\\BundleWithBootstrapperApplicationSourceAndBootstrapperApplicationDll.wxs(3)." |
| 73 | }, messages); |
| 74 | } |
| 75 | } |
| 76 | } |
| 77 | } |