diff options
Diffstat (limited to 'src/ext/Bal/test')
74 files changed, 2096 insertions, 0 deletions
diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs b/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs new file mode 100644 index 00000000..2ff57c55 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs | |||
@@ -0,0 +1,133 @@ | |||
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.Bal | ||
4 | { | ||
5 | using System.IO; | ||
6 | using System.Linq; | ||
7 | using System.Xml; | ||
8 | using WixBuildTools.TestSupport; | ||
9 | using WixToolset.Core.TestPackage; | ||
10 | using Xunit; | ||
11 | |||
12 | public class BalExtensionFixture | ||
13 | { | ||
14 | [Fact] | ||
15 | public void CanBuildUsingDisplayInternalUICondition() | ||
16 | { | ||
17 | using (var fs = new DisposableFileSystem()) | ||
18 | { | ||
19 | var baseFolder = fs.GetFolder(); | ||
20 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
21 | var bundleSourceFolder = TestData.Get(@"TestData\WixStdBa"); | ||
22 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
23 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
24 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
25 | |||
26 | var compileResult = WixRunner.Execute(new[] | ||
27 | { | ||
28 | "build", | ||
29 | Path.Combine(bundleSourceFolder, "DisplayInternalUIConditionBundle.wxs"), | ||
30 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
31 | "-intermediateFolder", intermediateFolder, | ||
32 | "-bindpath", Path.Combine(bundleSourceFolder, "data"), | ||
33 | "-o", bundleFile, | ||
34 | }); | ||
35 | compileResult.AssertSuccess(); | ||
36 | |||
37 | Assert.True(File.Exists(bundleFile)); | ||
38 | |||
39 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath); | ||
40 | extractResult.AssertSuccess(); | ||
41 | |||
42 | var balPackageInfos = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:WixBalPackageInfo"); | ||
43 | var balPackageInfo = (XmlNode)Assert.Single(balPackageInfos); | ||
44 | Assert.Equal("<WixBalPackageInfo PackageId='test.msi' DisplayInternalUICondition='1' />", balPackageInfo.GetTestXml()); | ||
45 | |||
46 | Assert.True(File.Exists(Path.Combine(baFolderPath, "thm.wxl"))); | ||
47 | } | ||
48 | } | ||
49 | |||
50 | [Fact] | ||
51 | public void CanBuildUsingOverridable() | ||
52 | { | ||
53 | using (var fs = new DisposableFileSystem()) | ||
54 | { | ||
55 | var baseFolder = fs.GetFolder(); | ||
56 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
57 | var bundleSourceFolder = TestData.Get(@"TestData\Overridable"); | ||
58 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
59 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
60 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
61 | |||
62 | var compileResult = WixRunner.Execute(new[] | ||
63 | { | ||
64 | "build", | ||
65 | Path.Combine(bundleSourceFolder, "Bundle.wxs"), | ||
66 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
67 | "-intermediateFolder", intermediateFolder, | ||
68 | "-o", bundleFile, | ||
69 | }); | ||
70 | compileResult.AssertSuccess(); | ||
71 | |||
72 | Assert.True(File.Exists(bundleFile)); | ||
73 | |||
74 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath); | ||
75 | extractResult.AssertSuccess(); | ||
76 | |||
77 | var balOverridableVariables = extractResult.SelectBADataNodes("/ba:BootstrapperApplicationData/ba:WixStdbaOverridableVariable"); | ||
78 | var balOverridableVariable = (XmlNode)Assert.Single(balOverridableVariables); | ||
79 | Assert.Equal("<WixStdbaOverridableVariable Name='Test1' />", balOverridableVariable.GetTestXml()); | ||
80 | } | ||
81 | } | ||
82 | |||
83 | [Fact] | ||
84 | public void CanBuildUsingWixStdBa() | ||
85 | { | ||
86 | using (var fs = new DisposableFileSystem()) | ||
87 | { | ||
88 | var baseFolder = fs.GetFolder(); | ||
89 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
90 | var bundleSourceFolder = TestData.Get(@"TestData\WixStdBa"); | ||
91 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
92 | |||
93 | var compileResult = WixRunner.Execute(new[] | ||
94 | { | ||
95 | "build", | ||
96 | Path.Combine(bundleSourceFolder, "Bundle.wxs"), | ||
97 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
98 | "-intermediateFolder", intermediateFolder, | ||
99 | "-o", bundleFile, | ||
100 | }); | ||
101 | compileResult.AssertSuccess(); | ||
102 | |||
103 | Assert.True(File.Exists(bundleFile)); | ||
104 | } | ||
105 | } | ||
106 | |||
107 | [Fact] | ||
108 | public void CantBuildUsingMBAWithNoPrereqs() | ||
109 | { | ||
110 | using (var fs = new DisposableFileSystem()) | ||
111 | { | ||
112 | var baseFolder = fs.GetFolder(); | ||
113 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
114 | var bundleSourceFolder = TestData.Get(@"TestData\MBA"); | ||
115 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
116 | |||
117 | var compileResult = WixRunner.Execute(new[] | ||
118 | { | ||
119 | "build", | ||
120 | Path.Combine(bundleSourceFolder, "Bundle.wxs"), | ||
121 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
122 | "-intermediateFolder", intermediateFolder, | ||
123 | "-o", bundleFile, | ||
124 | }); | ||
125 | Assert.Equal(6802, compileResult.ExitCode); | ||
126 | Assert.Equal("There must be at least one PrereqPackage when using the ManagedBootstrapperApplicationHost.\nThis is typically done by using the WixNetFxExtension and referencing one of the NetFxAsPrereq package groups.", compileResult.Messages[0].ToString()); | ||
127 | |||
128 | Assert.False(File.Exists(bundleFile)); | ||
129 | Assert.False(File.Exists(Path.Combine(intermediateFolder, "test.exe"))); | ||
130 | } | ||
131 | } | ||
132 | } | ||
133 | } | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs new file mode 100644 index 00000000..ba1aefba --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/MBA/Bundle.wxs | |||
@@ -0,0 +1,12 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" | ||
3 | xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
4 | <Bundle Name="WixStdBa" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="75D5D534-E177-4689-AAE9-CAC1C39002C2"> | ||
5 | <BootstrapperApplication> | ||
6 | <bal:WixManagedBootstrapperApplicationHost /> | ||
7 | </BootstrapperApplication> | ||
8 | <Chain> | ||
9 | <ExePackage Permanent="yes" DetectCondition="none" SourceFile="runtimes\win-x86\native\wixnative.exe" /> | ||
10 | </Chain> | ||
11 | </Bundle> | ||
12 | </Wix> | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/Overridable/Bundle.wxs b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/Overridable/Bundle.wxs new file mode 100644 index 00000000..91380c69 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/Overridable/Bundle.wxs | |||
@@ -0,0 +1,13 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" | ||
3 | xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
4 | <Bundle Name="WixStdBa" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="75D5D534-E177-4689-AAE9-CAC1C39002C2"> | ||
5 | <BootstrapperApplication> | ||
6 | <bal:WixStandardBootstrapperApplication LicenseUrl="http://wixtoolset.org/about/license/" Theme="hyperlinkLicense" /> | ||
7 | </BootstrapperApplication> | ||
8 | <Variable Name="Test1" bal:Overridable="yes" /> | ||
9 | <Chain> | ||
10 | <ExePackage Permanent="yes" DetectCondition="none" SourceFile="runtimes\win-x86\native\wixnative.exe" /> | ||
11 | </Chain> | ||
12 | </Bundle> | ||
13 | </Wix> | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/Bundle.wxs b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/Bundle.wxs new file mode 100644 index 00000000..c17b53ff --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/Bundle.wxs | |||
@@ -0,0 +1,12 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" | ||
3 | xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
4 | <Bundle Name="WixStdBa" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="75D5D534-E177-4689-AAE9-CAC1C39002C2"> | ||
5 | <BootstrapperApplication> | ||
6 | <bal:WixStandardBootstrapperApplication LicenseUrl="http://wixtoolset.org/about/license/" Theme="hyperlinkLicense" /> | ||
7 | </BootstrapperApplication> | ||
8 | <Chain> | ||
9 | <ExePackage Permanent="yes" DetectCondition="none" SourceFile="runtimes\win-x86\native\wixnative.exe" /> | ||
10 | </Chain> | ||
11 | </Bundle> | ||
12 | </Wix> | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/Data/test.msi b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/Data/test.msi new file mode 100644 index 00000000..94aacd1a --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/Data/test.msi | |||
Binary files differ | |||
diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/DisplayInternalUIConditionBundle.wxs b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/DisplayInternalUIConditionBundle.wxs new file mode 100644 index 00000000..f08cfe6a --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/WixStdBa/DisplayInternalUIConditionBundle.wxs | |||
@@ -0,0 +1,12 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" | ||
3 | xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
4 | <Bundle Name="WixStdBa" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="75D5D534-E177-4689-AAE9-CAC1C39002C2"> | ||
5 | <BootstrapperApplication> | ||
6 | <bal:WixStandardBootstrapperApplication LicenseUrl="http://wixtoolset.org/about/license/" Theme="hyperlinkLicense" /> | ||
7 | </BootstrapperApplication> | ||
8 | <Chain> | ||
9 | <MsiPackage SourceFile="test.msi" bal:DisplayInternalUICondition="1" /> | ||
10 | </Chain> | ||
11 | </Bundle> | ||
12 | </Wix> | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/WixToolsetTest.Bal.csproj b/src/ext/Bal/test/WixToolsetTest.Bal/WixToolsetTest.Bal.csproj new file mode 100644 index 00000000..c9ab4219 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/WixToolsetTest.Bal.csproj | |||
@@ -0,0 +1,43 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
5 | <PropertyGroup> | ||
6 | <TargetFramework>netcoreapp3.1</TargetFramework> | ||
7 | <IsPackable>false</IsPackable> | ||
8 | </PropertyGroup> | ||
9 | |||
10 | <ItemGroup> | ||
11 | <Content Include="TestData\MBA\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
12 | <Content Include="TestData\Overridable\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
13 | <Content Include="TestData\WixStdBa\Bundle.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
14 | <Content Include="TestData\WixStdBa\Data\test.msi" CopyToOutputDirectory="PreserveNewest" /> | ||
15 | <Content Include="TestData\WixStdBa\DisplayInternalUIConditionBundle.wxs" CopyToOutputDirectory="PreserveNewest" /> | ||
16 | </ItemGroup> | ||
17 | |||
18 | <Target Name="CopyExtensions" AfterTargets="Build"> | ||
19 | <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(WixExtension)" /> | ||
20 | </Target> | ||
21 | |||
22 | <ItemGroup> | ||
23 | <ProjectReference Include="..\..\wixext\WixToolset.Bal.wixext.csproj" /> | ||
24 | </ItemGroup> | ||
25 | |||
26 | <ItemGroup> | ||
27 | <PackageReference Include="WixToolset.Core" Version="4.0.*" /> | ||
28 | <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" /> | ||
29 | <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" /> | ||
30 | <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" /> | ||
31 | <PackageReference Include="WixToolset.Data" Version="4.0.*" /> | ||
32 | </ItemGroup> | ||
33 | |||
34 | <ItemGroup> | ||
35 | <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" /> | ||
36 | </ItemGroup> | ||
37 | |||
38 | <ItemGroup> | ||
39 | <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" /> | ||
40 | <PackageReference Include="xunit" Version="2.4.1" /> | ||
41 | <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" /> | ||
42 | </ItemGroup> | ||
43 | </Project> | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/WixToolsetTest.Bal.v3.ncrunchproject b/src/ext/Bal/test/WixToolsetTest.Bal/WixToolsetTest.Bal.v3.ncrunchproject new file mode 100644 index 00000000..7b5b2139 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/WixToolsetTest.Bal.v3.ncrunchproject | |||
@@ -0,0 +1,5 @@ | |||
1 | <ProjectConfiguration> | ||
2 | <Settings> | ||
3 | <CopyReferencedAssembliesToWorkspace>True</CopyReferencedAssembliesToWorkspace> | ||
4 | </Settings> | ||
5 | </ProjectConfiguration> \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs new file mode 100644 index 00000000..af5f2543 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs | |||
@@ -0,0 +1,209 @@ | |||
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.ManagedHost | ||
4 | { | ||
5 | using System.IO; | ||
6 | using WixBuildTools.TestSupport; | ||
7 | using WixToolset.Core.TestPackage; | ||
8 | using Xunit; | ||
9 | |||
10 | public class DncHostFixture | ||
11 | { | ||
12 | static readonly string bundleBasePath = TestData.Get("..", "examples"); | ||
13 | |||
14 | [Fact] | ||
15 | public void CanLoadFDDEarliestCoreMBA() | ||
16 | { | ||
17 | using (var fs = new DisposableFileSystem()) | ||
18 | { | ||
19 | var baseFolder = fs.GetFolder(); | ||
20 | var bundleFile = TestData.Get(bundleBasePath, "EarliestCoreBundleFDD.exe"); | ||
21 | var testEngine = new TestEngine(); | ||
22 | |||
23 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | ||
24 | var logMessages = result.Output; | ||
25 | Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[0]); | ||
26 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | ||
27 | Assert.Equal("EarliestCoreBA", logMessages[2]); | ||
28 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
29 | } | ||
30 | } | ||
31 | |||
32 | [Fact] | ||
33 | public void CanLoadSCDEarliestCoreMBA() | ||
34 | { | ||
35 | using (var fs = new DisposableFileSystem()) | ||
36 | { | ||
37 | var baseFolder = fs.GetFolder(); | ||
38 | var bundleFile = TestData.Get(bundleBasePath, "EarliestCoreBundleSCD.exe"); | ||
39 | var testEngine = new TestEngine(); | ||
40 | |||
41 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | ||
42 | var logMessages = result.Output; | ||
43 | Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); | ||
44 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | ||
45 | Assert.Equal("EarliestCoreBA", logMessages[2]); | ||
46 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
47 | } | ||
48 | } | ||
49 | |||
50 | [Fact] | ||
51 | public void CanLoadTrimmedSCDEarliestCoreMBA() | ||
52 | { | ||
53 | using (var fs = new DisposableFileSystem()) | ||
54 | { | ||
55 | var baseFolder = fs.GetFolder(); | ||
56 | var bundleFile = TestData.Get(bundleBasePath, "EarliestCoreBundleTrimmedSCD.exe"); | ||
57 | var testEngine = new TestEngine(); | ||
58 | |||
59 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | ||
60 | var logMessages = result.Output; | ||
61 | Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); | ||
62 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | ||
63 | Assert.Equal("EarliestCoreBA", logMessages[2]); | ||
64 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | [Fact] | ||
69 | public void CanReloadSCDEarliestCoreMBA() | ||
70 | { | ||
71 | using (var fs = new DisposableFileSystem()) | ||
72 | { | ||
73 | var baseFolder = fs.GetFolder(); | ||
74 | var bundleFile = TestData.Get(bundleBasePath, "EarliestCoreBundleSCD.exe"); | ||
75 | var testEngine = new TestEngine(); | ||
76 | |||
77 | var result = testEngine.RunReloadEngine(bundleFile, baseFolder); | ||
78 | var logMessages = result.Output; | ||
79 | Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); | ||
80 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | ||
81 | Assert.Equal("EarliestCoreBA", logMessages[2]); | ||
82 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
83 | Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[4]); | ||
84 | Assert.Equal("Reloaded 1 time(s)", logMessages[5]); // dnchost doesn't currently support unloading | ||
85 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[6]); | ||
86 | Assert.Equal("EarliestCoreBA", logMessages[7]); | ||
87 | Assert.Equal("Shutdown,Restart,0", logMessages[8]); | ||
88 | } | ||
89 | } | ||
90 | |||
91 | [Fact] | ||
92 | public void CanLoadFDDLatestCoreMBA() | ||
93 | { | ||
94 | using (var fs = new DisposableFileSystem()) | ||
95 | { | ||
96 | var baseFolder = fs.GetFolder(); | ||
97 | var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleFDD.exe"); | ||
98 | var testEngine = new TestEngine(); | ||
99 | |||
100 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | ||
101 | var logMessages = result.Output; | ||
102 | Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[0]); | ||
103 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | ||
104 | Assert.Equal("LatestCoreBA", logMessages[2]); | ||
105 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
106 | } | ||
107 | } | ||
108 | |||
109 | [Fact] | ||
110 | public void CanReloadFDDLatestCoreMBA() | ||
111 | { | ||
112 | using (var fs = new DisposableFileSystem()) | ||
113 | { | ||
114 | var baseFolder = fs.GetFolder(); | ||
115 | var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleFDD.exe"); | ||
116 | var testEngine = new TestEngine(); | ||
117 | |||
118 | var result = testEngine.RunReloadEngine(bundleFile, baseFolder); | ||
119 | var logMessages = result.Output; | ||
120 | Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[0]); | ||
121 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | ||
122 | Assert.Equal("LatestCoreBA", logMessages[2]); | ||
123 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
124 | Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[4]); | ||
125 | Assert.Equal("Reloaded 1 time(s)", logMessages[5]); // dnchost doesn't currently support unloading | ||
126 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[6]); | ||
127 | Assert.Equal("LatestCoreBA", logMessages[7]); | ||
128 | Assert.Equal("Shutdown,Restart,0", logMessages[8]); | ||
129 | } | ||
130 | } | ||
131 | |||
132 | [Fact] | ||
133 | public void CanLoadSCDLatestCoreMBA() | ||
134 | { | ||
135 | using (var fs = new DisposableFileSystem()) | ||
136 | { | ||
137 | var baseFolder = fs.GetFolder(); | ||
138 | var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleSCD.exe"); | ||
139 | var testEngine = new TestEngine(); | ||
140 | |||
141 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | ||
142 | var logMessages = result.Output; | ||
143 | Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); | ||
144 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | ||
145 | Assert.Equal("LatestCoreBA", logMessages[2]); | ||
146 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
147 | } | ||
148 | } | ||
149 | |||
150 | [Fact] | ||
151 | public void CanLoadTrimmedSCDLatestCoreMBA() | ||
152 | { | ||
153 | using (var fs = new DisposableFileSystem()) | ||
154 | { | ||
155 | var baseFolder = fs.GetFolder(); | ||
156 | var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleTrimmedSCD.exe"); | ||
157 | var testEngine = new TestEngine(); | ||
158 | |||
159 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | ||
160 | var logMessages = result.Output; | ||
161 | Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); | ||
162 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | ||
163 | Assert.Equal("LatestCoreBA", logMessages[2]); | ||
164 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
165 | } | ||
166 | } | ||
167 | |||
168 | [Fact] | ||
169 | public void CanReloadSCDLatestCoreMBA() | ||
170 | { | ||
171 | using (var fs = new DisposableFileSystem()) | ||
172 | { | ||
173 | var baseFolder = fs.GetFolder(); | ||
174 | var bundleFile = TestData.Get(bundleBasePath, "LatestCoreBundleSCD.exe"); | ||
175 | var testEngine = new TestEngine(); | ||
176 | |||
177 | var result = testEngine.RunReloadEngine(bundleFile, baseFolder); | ||
178 | var logMessages = result.Output; | ||
179 | Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); | ||
180 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | ||
181 | Assert.Equal("LatestCoreBA", logMessages[2]); | ||
182 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
183 | Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[4]); | ||
184 | Assert.Equal("Reloaded 1 time(s)", logMessages[5]); // dnchost doesn't currently support unloading | ||
185 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[6]); | ||
186 | Assert.Equal("LatestCoreBA", logMessages[7]); | ||
187 | Assert.Equal("Shutdown,Restart,0", logMessages[8]); | ||
188 | } | ||
189 | } | ||
190 | |||
191 | [Fact] | ||
192 | public void CanLoadFDDWPFCoreMBA() | ||
193 | { | ||
194 | using (var fs = new DisposableFileSystem()) | ||
195 | { | ||
196 | var baseFolder = fs.GetFolder(); | ||
197 | var bundleFile = TestData.Get(bundleBasePath, "WPFCoreBundleFDD.exe"); | ||
198 | var testEngine = new TestEngine(); | ||
199 | |||
200 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | ||
201 | var logMessages = result.Output; | ||
202 | Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[0]); | ||
203 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | ||
204 | Assert.Equal("WPFCoreBA", logMessages[2]); | ||
205 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
206 | } | ||
207 | } | ||
208 | } | ||
209 | } | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs new file mode 100644 index 00000000..dd37ee58 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs | |||
@@ -0,0 +1,94 @@ | |||
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.ManagedHost | ||
4 | { | ||
5 | using System.IO; | ||
6 | using WixBuildTools.TestSupport; | ||
7 | using WixToolset.Core.TestPackage; | ||
8 | using Xunit; | ||
9 | |||
10 | public class MbaHostFixture | ||
11 | { | ||
12 | static readonly string bundleBasePath = TestData.Get("..", "examples"); | ||
13 | |||
14 | [Fact] | ||
15 | public void CanLoadFullFramework2MBA() | ||
16 | { | ||
17 | using (var fs = new DisposableFileSystem()) | ||
18 | { | ||
19 | var baseFolder = fs.GetFolder(); | ||
20 | var bundleFile = TestData.Get(bundleBasePath, "FullFramework2Bundle.exe"); | ||
21 | var testEngine = new TestEngine(); | ||
22 | |||
23 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | ||
24 | var logMessages = result.Output; | ||
25 | Assert.Equal("Loading managed bootstrapper application.", logMessages[0]); | ||
26 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | ||
27 | Assert.Equal("FullFramework2BA", logMessages[2]); | ||
28 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
29 | } | ||
30 | } | ||
31 | |||
32 | [Fact] | ||
33 | public void CanLoadFullFramework4MBA() | ||
34 | { | ||
35 | using (var fs = new DisposableFileSystem()) | ||
36 | { | ||
37 | var baseFolder = fs.GetFolder(); | ||
38 | var bundleFile = TestData.Get(bundleBasePath, "FullFramework4Bundle.exe"); | ||
39 | var testEngine = new TestEngine(); | ||
40 | |||
41 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | ||
42 | var logMessages = result.Output; | ||
43 | Assert.Equal("Loading managed bootstrapper application.", logMessages[0]); | ||
44 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | ||
45 | Assert.Equal("FullFramework4BA", logMessages[2]); | ||
46 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
47 | } | ||
48 | } | ||
49 | |||
50 | [Fact] | ||
51 | public void CanReloadFullFramework2MBA() | ||
52 | { | ||
53 | using (var fs = new DisposableFileSystem()) | ||
54 | { | ||
55 | var baseFolder = fs.GetFolder(); | ||
56 | var bundleFile = TestData.Get(bundleBasePath, "FullFramework2Bundle.exe"); | ||
57 | var testEngine = new TestEngine(); | ||
58 | |||
59 | var result = testEngine.RunReloadEngine(bundleFile, baseFolder); | ||
60 | var logMessages = result.Output; | ||
61 | Assert.Equal("Loading managed bootstrapper application.", logMessages[0]); | ||
62 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | ||
63 | Assert.Equal("FullFramework2BA", logMessages[2]); | ||
64 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
65 | Assert.Equal("Loading managed bootstrapper application.", logMessages[4]); | ||
66 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[5]); | ||
67 | Assert.Equal("FullFramework2BA", logMessages[6]); | ||
68 | Assert.Equal("Shutdown,Restart,0", logMessages[7]); | ||
69 | } | ||
70 | } | ||
71 | |||
72 | [Fact] | ||
73 | public void CanReloadFullFramework4MBA() | ||
74 | { | ||
75 | using (var fs = new DisposableFileSystem()) | ||
76 | { | ||
77 | var baseFolder = fs.GetFolder(); | ||
78 | var bundleFile = TestData.Get(bundleBasePath, "FullFramework4Bundle.exe"); | ||
79 | var testEngine = new TestEngine(); | ||
80 | |||
81 | var result = testEngine.RunReloadEngine(bundleFile, baseFolder); | ||
82 | var logMessages = result.Output; | ||
83 | Assert.Equal("Loading managed bootstrapper application.", logMessages[0]); | ||
84 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | ||
85 | Assert.Equal("FullFramework4BA", logMessages[2]); | ||
86 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
87 | Assert.Equal("Loading managed bootstrapper application.", logMessages[4]); | ||
88 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[5]); | ||
89 | Assert.Equal("FullFramework4BA", logMessages[6]); | ||
90 | Assert.Equal("Shutdown,Restart,0", logMessages[7]); | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | } | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/README.md b/src/ext/Bal/test/WixToolsetTest.ManagedHost/README.md new file mode 100644 index 00000000..d7e73df2 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.ManagedHost/README.md | |||
@@ -0,0 +1,5 @@ | |||
1 | In order to properly test dnchost and mbahost, | ||
2 | the managed BAs need to be published and a bundle needs to be built for each scenario. | ||
3 | Making this happen on every build for the solution takes too long, | ||
4 | so this project relies on manually running appveyor.cmd to publish everything before the tests can be run. | ||
5 | appveyor.cmd needs to be ran again every time changes are made in other projects. \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs new file mode 100644 index 00000000..44538227 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs | |||
@@ -0,0 +1,74 @@ | |||
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.ManagedHost | ||
4 | { | ||
5 | using System.Collections.Generic; | ||
6 | using System.Diagnostics; | ||
7 | using System.IO; | ||
8 | using WixBuildTools.TestSupport; | ||
9 | using WixToolset.Core.TestPackage; | ||
10 | |||
11 | public class TestEngine | ||
12 | { | ||
13 | private static readonly string TestEngineFile = TestData.Get(@"..\Win32\examples\Example.TestEngine\Example.TestEngine.exe"); | ||
14 | |||
15 | public TestEngineResult RunReloadEngine(string bundleFilePath, string tempFolderPath) | ||
16 | { | ||
17 | return this.RunTestEngine("reload", bundleFilePath, tempFolderPath); | ||
18 | } | ||
19 | |||
20 | public TestEngineResult RunShutdownEngine(string bundleFilePath, string tempFolderPath) | ||
21 | { | ||
22 | return this.RunTestEngine("shutdown", bundleFilePath, tempFolderPath); | ||
23 | } | ||
24 | |||
25 | private TestEngineResult RunTestEngine(string engineMode, string bundleFilePath, string tempFolderPath) | ||
26 | { | ||
27 | var baFolderPath = Path.Combine(tempFolderPath, "ba"); | ||
28 | var extractFolderPath = Path.Combine(tempFolderPath, "extract"); | ||
29 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFilePath, baFolderPath, extractFolderPath); | ||
30 | extractResult.AssertSuccess(); | ||
31 | |||
32 | var args = new string[] { | ||
33 | engineMode, | ||
34 | '"' + bundleFilePath + '"', | ||
35 | '"' + extractResult.GetBAFilePath(baFolderPath) + '"', | ||
36 | }; | ||
37 | return RunProcessCaptureOutput(TestEngineFile, args); | ||
38 | } | ||
39 | |||
40 | private static TestEngineResult RunProcessCaptureOutput(string executablePath, string[] arguments = null, string workingFolder = null) | ||
41 | { | ||
42 | var startInfo = new ProcessStartInfo(executablePath) | ||
43 | { | ||
44 | Arguments = string.Join(' ', arguments), | ||
45 | CreateNoWindow = true, | ||
46 | RedirectStandardError = true, | ||
47 | RedirectStandardOutput = true, | ||
48 | UseShellExecute = false, | ||
49 | WorkingDirectory = workingFolder, | ||
50 | }; | ||
51 | |||
52 | var exitCode = 0; | ||
53 | var output = new List<string>(); | ||
54 | |||
55 | using (var process = Process.Start(startInfo)) | ||
56 | { | ||
57 | process.OutputDataReceived += (s, e) => { if (e.Data != null) { output.Add(e.Data); } }; | ||
58 | process.ErrorDataReceived += (s, e) => { if (e.Data != null) { output.Add(e.Data); } }; | ||
59 | |||
60 | process.BeginErrorReadLine(); | ||
61 | process.BeginOutputReadLine(); | ||
62 | |||
63 | process.WaitForExit(); | ||
64 | exitCode = process.ExitCode; | ||
65 | } | ||
66 | |||
67 | return new TestEngineResult | ||
68 | { | ||
69 | ExitCode = exitCode, | ||
70 | Output = output, | ||
71 | }; | ||
72 | } | ||
73 | } | ||
74 | } | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngineResult.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngineResult.cs new file mode 100644 index 00000000..63f6f7f5 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngineResult.cs | |||
@@ -0,0 +1,12 @@ | |||
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.ManagedHost | ||
4 | { | ||
5 | using System.Collections.Generic; | ||
6 | |||
7 | public class TestEngineResult | ||
8 | { | ||
9 | public int ExitCode { get; set; } | ||
10 | public List<string> Output { get; set; } | ||
11 | } | ||
12 | } | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj b/src/ext/Bal/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj new file mode 100644 index 00000000..38c8926c --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj | |||
@@ -0,0 +1,25 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
5 | <PropertyGroup> | ||
6 | <TargetFramework>netcoreapp3.1</TargetFramework> | ||
7 | </PropertyGroup> | ||
8 | |||
9 | <ItemGroup> | ||
10 | <ProjectReference Include="..\examples\TestEngine\Example.TestEngine.vcxproj" /> | ||
11 | </ItemGroup> | ||
12 | |||
13 | <ItemGroup> | ||
14 | <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" /> | ||
15 | <PackageReference Include="WixToolset.Core.Burn" Version="4.0.*" /> | ||
16 | <PackageReference Include="WixToolset.Core.WindowsInstaller" Version="4.0.*" /> | ||
17 | <PackageReference Include="WixToolset.Core.TestPackage" Version="4.0.*" /> | ||
18 | </ItemGroup> | ||
19 | |||
20 | <ItemGroup> | ||
21 | <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" /> | ||
22 | <PackageReference Include="xunit" Version="2.4.1" /> | ||
23 | <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" /> | ||
24 | </ItemGroup> | ||
25 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/Directory.Build.props b/src/ext/Bal/test/examples/Directory.Build.props new file mode 100644 index 00000000..3d5870a5 --- /dev/null +++ b/src/ext/Bal/test/examples/Directory.Build.props | |||
@@ -0,0 +1,6 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | <Project> | ||
4 | <Import Project="..\..\Directory.Build.props" /> | ||
5 | <Import Project="Wix.Build.props" Condition=" '$(MSBuildProjectExtension)'=='.wixproj' " /> | ||
6 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/Directory.Build.targets b/src/ext/Bal/test/examples/Directory.Build.targets new file mode 100644 index 00000000..6dcf402b --- /dev/null +++ b/src/ext/Bal/test/examples/Directory.Build.targets | |||
@@ -0,0 +1,6 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | <Project> | ||
4 | <Import Project="..\..\Directory.Build.targets" /> | ||
5 | <Import Project="Wix.Build.targets" Condition=" '$(MSBuildProjectExtension)'=='.wixproj' " /> | ||
6 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleFDD/EarliestCoreBundleFDD.wixproj b/src/ext/Bal/test/examples/EarliestCoreBundleFDD/EarliestCoreBundleFDD.wixproj new file mode 100644 index 00000000..ba75a9ff --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleFDD/EarliestCoreBundleFDD.wixproj | |||
@@ -0,0 +1,2 @@ | |||
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 | <Project Sdk="WixToolset.Sdk" /> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs b/src/ext/Bal/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs new file mode 100644 index 00000000..d146845c --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs | |||
@@ -0,0 +1,16 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
2 | <Bundle Name="FDDEarliestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
3 | <BootstrapperApplication> | ||
4 | <Payload SourceFile="publish\Example.EarliestCoreMBA\fdd\Example.EarliestCoreMBA.deps.json" Name="Example.EarliestCoreMBA.deps.json" /> | ||
5 | <Payload SourceFile="publish\Example.EarliestCoreMBA\fdd\Example.EarliestCoreMBA.dll" Name="Example.EarliestCoreMBA.dll" bal:BAFactoryAssembly="yes" /> | ||
6 | <Payload SourceFile="publish\Example.EarliestCoreMBA\fdd\Example.EarliestCoreMBA.pdb" Name="Example.EarliestCoreMBA.pdb" /> | ||
7 | <Payload SourceFile="publish\Example.EarliestCoreMBA\fdd\Example.EarliestCoreMBA.runtimeconfig.json" Name="Example.EarliestCoreMBA.runtimeconfig.json" /> | ||
8 | <Payload SourceFile="publish\Example.EarliestCoreMBA\fdd\mbanative.dll" Name="mbanative.dll" /> | ||
9 | <Payload SourceFile="publish\Example.EarliestCoreMBA\fdd\WixToolset.Mba.Core.dll" Name="WixToolset.Mba.Core.dll" /> | ||
10 | <bal:WixDotNetCoreBootstrapperApplicationHost /> | ||
11 | </BootstrapperApplication> | ||
12 | <Chain> | ||
13 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" bal:PrereqPackage="yes" /> | ||
14 | </Chain> | ||
15 | </Bundle> | ||
16 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleSCD/EarliestCoreBundleSCD.wixproj b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/EarliestCoreBundleSCD.wixproj new file mode 100644 index 00000000..ebeebff2 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/EarliestCoreBundleSCD.wixproj | |||
@@ -0,0 +1,10 @@ | |||
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 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <ItemGroup> | ||
4 | <BindInputPaths Include="$(OutputPath)publish\Example.EarliestCoreMBA\scd" /> | ||
5 | <HarvestDirectory Include="$(OutputPath)publish\Example.EarliestCoreMBA\scd"> | ||
6 | <DirectoryRefId>publish.Example.EarliestCoreMBA.scd</DirectoryRefId> | ||
7 | <Transforms>ba.xslt</Transforms> | ||
8 | </HarvestDirectory> | ||
9 | </ItemGroup> | ||
10 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs new file mode 100644 index 00000000..4d872317 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs | |||
@@ -0,0 +1,11 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
2 | <Bundle Name="SCDEarliestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
3 | <BootstrapperApplication> | ||
4 | <bal:WixDotNetCoreBootstrapperApplicationHost SelfContainedDeployment="yes" /> | ||
5 | <PayloadGroupRef Id="publish.Example.EarliestCoreMBA.scd" /> | ||
6 | </BootstrapperApplication> | ||
7 | <Chain> | ||
8 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" PerMachine="yes" /> | ||
9 | </Chain> | ||
10 | </Bundle> | ||
11 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleSCD/ba.xslt b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/ba.xslt new file mode 100644 index 00000000..06b84256 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/ba.xslt | |||
@@ -0,0 +1,20 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
3 | xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" | ||
4 | xmlns:wix="http://wixtoolset.org/schemas/v4/wxs" | ||
5 | > | ||
6 | <xsl:output method="xml" indent="yes"/> | ||
7 | |||
8 | <xsl:template match="@* | node()"> | ||
9 | <xsl:copy> | ||
10 | <xsl:apply-templates select="@* | node()"/> | ||
11 | </xsl:copy> | ||
12 | </xsl:template> | ||
13 | |||
14 | <xsl:template match="wix:Payload[@SourceFile='SourceDir\Example.EarliestCoreMBA.dll']" > | ||
15 | <xsl:copy> | ||
16 | <xsl:attribute name="BAFactoryAssembly" namespace="http://wixtoolset.org/schemas/v4/wxs/bal">yes</xsl:attribute> | ||
17 | <xsl:apply-templates select="@* | node()"/> | ||
18 | </xsl:copy> | ||
19 | </xsl:template> | ||
20 | </xsl:stylesheet> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/EarliestCoreBundleTrimmedSCD.wixproj b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/EarliestCoreBundleTrimmedSCD.wixproj new file mode 100644 index 00000000..a6b56460 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/EarliestCoreBundleTrimmedSCD.wixproj | |||
@@ -0,0 +1,10 @@ | |||
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 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <ItemGroup> | ||
4 | <BindInputPaths Include="$(OutputPath)publish\Example.EarliestCoreMBA\trimmedscd" /> | ||
5 | <HarvestDirectory Include="$(OutputPath)publish\Example.EarliestCoreMBA\trimmedscd"> | ||
6 | <DirectoryRefId>publish.Example.EarliestCoreMBA.trimmedscd</DirectoryRefId> | ||
7 | <Transforms>ba.xslt</Transforms> | ||
8 | </HarvestDirectory> | ||
9 | </ItemGroup> | ||
10 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs new file mode 100644 index 00000000..ba7dce25 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs | |||
@@ -0,0 +1,11 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
2 | <Bundle Name="TrimmedSCDEarliestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
3 | <BootstrapperApplication> | ||
4 | <bal:WixDotNetCoreBootstrapperApplicationHost SelfContainedDeployment="yes" /> | ||
5 | <PayloadGroupRef Id="publish.Example.EarliestCoreMBA.trimmedscd" /> | ||
6 | </BootstrapperApplication> | ||
7 | <Chain> | ||
8 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" PerMachine="yes" /> | ||
9 | </Chain> | ||
10 | </Bundle> | ||
11 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/ba.xslt b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/ba.xslt new file mode 100644 index 00000000..06b84256 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/ba.xslt | |||
@@ -0,0 +1,20 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
3 | xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" | ||
4 | xmlns:wix="http://wixtoolset.org/schemas/v4/wxs" | ||
5 | > | ||
6 | <xsl:output method="xml" indent="yes"/> | ||
7 | |||
8 | <xsl:template match="@* | node()"> | ||
9 | <xsl:copy> | ||
10 | <xsl:apply-templates select="@* | node()"/> | ||
11 | </xsl:copy> | ||
12 | </xsl:template> | ||
13 | |||
14 | <xsl:template match="wix:Payload[@SourceFile='SourceDir\Example.EarliestCoreMBA.dll']" > | ||
15 | <xsl:copy> | ||
16 | <xsl:attribute name="BAFactoryAssembly" namespace="http://wixtoolset.org/schemas/v4/wxs/bal">yes</xsl:attribute> | ||
17 | <xsl:apply-templates select="@* | node()"/> | ||
18 | </xsl:copy> | ||
19 | </xsl:template> | ||
20 | </xsl:stylesheet> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBA.cs b/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBA.cs new file mode 100644 index 00000000..c9291a7f --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBA.cs | |||
@@ -0,0 +1,34 @@ | |||
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 Example.EarliestCoreMBA | ||
4 | { | ||
5 | using WixToolset.Mba.Core; | ||
6 | |||
7 | public class EarliestCoreBA : BootstrapperApplication | ||
8 | { | ||
9 | public EarliestCoreBA(IEngine engine) | ||
10 | : base(engine) | ||
11 | { | ||
12 | |||
13 | } | ||
14 | |||
15 | protected override void Run() | ||
16 | { | ||
17 | } | ||
18 | |||
19 | protected override void OnStartup(StartupEventArgs args) | ||
20 | { | ||
21 | base.OnStartup(args); | ||
22 | |||
23 | this.engine.Log(LogLevel.Standard, nameof(EarliestCoreBA)); | ||
24 | } | ||
25 | |||
26 | protected override void OnShutdown(ShutdownEventArgs args) | ||
27 | { | ||
28 | base.OnShutdown(args); | ||
29 | |||
30 | var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); | ||
31 | this.engine.Log(LogLevel.Standard, message); | ||
32 | } | ||
33 | } | ||
34 | } | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs b/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs new file mode 100644 index 00000000..672e17ee --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs | |||
@@ -0,0 +1,22 @@ | |||
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 | [assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Example.EarliestCoreMBA.EarliestCoreBAFactory))] | ||
4 | namespace Example.EarliestCoreMBA | ||
5 | { | ||
6 | using WixToolset.Mba.Core; | ||
7 | |||
8 | public class EarliestCoreBAFactory : BaseBootstrapperApplicationFactory | ||
9 | { | ||
10 | private static int loadCount = 0; | ||
11 | |||
12 | protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) | ||
13 | { | ||
14 | if (loadCount > 0) | ||
15 | { | ||
16 | engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)"); | ||
17 | } | ||
18 | ++loadCount; | ||
19 | return new EarliestCoreBA(engine); | ||
20 | } | ||
21 | } | ||
22 | } | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj b/src/ext/Bal/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj new file mode 100644 index 00000000..cb66c138 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj | |||
@@ -0,0 +1,18 @@ | |||
1 | <Project Sdk="Microsoft.NET.Sdk"> | ||
2 | |||
3 | <PropertyGroup> | ||
4 | <TargetFramework>netcoreapp3.1</TargetFramework> | ||
5 | <RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers> | ||
6 | <EnableDynamicLoading>true</EnableDynamicLoading> | ||
7 | <Description>Earliest .NET Core MBA</Description> | ||
8 | </PropertyGroup> | ||
9 | |||
10 | <ItemGroup> | ||
11 | <TrimmerRootAssembly Include="System.Runtime.Loader" /> | ||
12 | </ItemGroup> | ||
13 | |||
14 | <ItemGroup> | ||
15 | <PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" /> | ||
16 | <PackageReference Include="WixToolset.Mba.Core" Version="4.0.*" /> | ||
17 | </ItemGroup> | ||
18 | </Project> \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/examples/FullFramework2Bundle/Bundle.wxs b/src/ext/Bal/test/examples/FullFramework2Bundle/Bundle.wxs new file mode 100644 index 00000000..f0af975c --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2Bundle/Bundle.wxs | |||
@@ -0,0 +1,14 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
2 | <Bundle Name="FullFramework2MBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
3 | <BootstrapperApplication> | ||
4 | <Payload SourceFile="Example.FullFramework2MBA\net20\win-x86\Example.FullFramework2MBA.dll" /> | ||
5 | <Payload SourceFile="Example.FullFramework2MBA\net20\win-x86\mbanative.dll" /> | ||
6 | <Payload SourceFile="Example.FullFramework2MBA\net20\win-x86\WixToolset.Mba.Core.dll" /> | ||
7 | <Payload SourceFile="Example.FullFramework2MBA\net20\win-x86\WixToolset.Mba.Host.config" /> | ||
8 | <bal:WixManagedBootstrapperApplicationHost /> | ||
9 | </BootstrapperApplication> | ||
10 | <Chain> | ||
11 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" bal:PrereqPackage="yes" /> | ||
12 | </Chain> | ||
13 | </Bundle> | ||
14 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/FullFramework2Bundle/FullFramework2Bundle.wixproj b/src/ext/Bal/test/examples/FullFramework2Bundle/FullFramework2Bundle.wixproj new file mode 100644 index 00000000..ba75a9ff --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2Bundle/FullFramework2Bundle.wixproj | |||
@@ -0,0 +1,2 @@ | |||
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 | <Project Sdk="WixToolset.Sdk" /> | ||
diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj b/src/ext/Bal/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj new file mode 100644 index 00000000..21079ed1 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj | |||
@@ -0,0 +1,20 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
5 | <PropertyGroup> | ||
6 | <TargetFramework>net20</TargetFramework> | ||
7 | <AssemblyName>Example.FullFramework2MBA</AssemblyName> | ||
8 | <RootNamespace>Example.FullFramework2MBA</RootNamespace> | ||
9 | <DebugType>embedded</DebugType> | ||
10 | <RuntimeIdentifier>win-x86</RuntimeIdentifier> | ||
11 | </PropertyGroup> | ||
12 | |||
13 | <ItemGroup> | ||
14 | <Content Include="WixToolset.Mba.Host.config" CopyToOutputDirectory="PreserveNewest" /> | ||
15 | </ItemGroup> | ||
16 | |||
17 | <ItemGroup> | ||
18 | <PackageReference Include="WixToolset.Mba.Core" Version="4.0.*" /> | ||
19 | </ItemGroup> | ||
20 | </Project> \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BA.cs b/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BA.cs new file mode 100644 index 00000000..32cd19c8 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BA.cs | |||
@@ -0,0 +1,34 @@ | |||
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 Example.FullFramework2MBA | ||
4 | { | ||
5 | using WixToolset.Mba.Core; | ||
6 | |||
7 | public class FullFramework2BA : BootstrapperApplication | ||
8 | { | ||
9 | public FullFramework2BA(IEngine engine) | ||
10 | : base(engine) | ||
11 | { | ||
12 | |||
13 | } | ||
14 | |||
15 | protected override void Run() | ||
16 | { | ||
17 | } | ||
18 | |||
19 | protected override void OnStartup(StartupEventArgs args) | ||
20 | { | ||
21 | base.OnStartup(args); | ||
22 | |||
23 | this.engine.Log(LogLevel.Standard, nameof(FullFramework2BA)); | ||
24 | } | ||
25 | |||
26 | protected override void OnShutdown(ShutdownEventArgs args) | ||
27 | { | ||
28 | base.OnShutdown(args); | ||
29 | |||
30 | var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); | ||
31 | this.engine.Log(LogLevel.Standard, message); | ||
32 | } | ||
33 | } | ||
34 | } | ||
diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs b/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs new file mode 100644 index 00000000..647c2040 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs | |||
@@ -0,0 +1,22 @@ | |||
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 | [assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Example.FullFramework2MBA.FullFramework2BAFactory))] | ||
4 | namespace Example.FullFramework2MBA | ||
5 | { | ||
6 | using WixToolset.Mba.Core; | ||
7 | |||
8 | public class FullFramework2BAFactory : BaseBootstrapperApplicationFactory | ||
9 | { | ||
10 | private static int loadCount = 0; | ||
11 | |||
12 | protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) | ||
13 | { | ||
14 | if (loadCount > 0) | ||
15 | { | ||
16 | engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)"); | ||
17 | } | ||
18 | ++loadCount; | ||
19 | return new FullFramework2BA(engine); | ||
20 | } | ||
21 | } | ||
22 | } | ||
diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config b/src/ext/Bal/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config new file mode 100644 index 00000000..be450a4f --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config | |||
@@ -0,0 +1,20 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | |||
5 | <configuration> | ||
6 | <configSections> | ||
7 | <sectionGroup name="wix.bootstrapper" type="WixToolset.Mba.Host.BootstrapperSectionGroup, WixToolset.Mba.Host"> | ||
8 | <section name="host" type="WixToolset.Mba.Host.HostSection, WixToolset.Mba.Host" /> | ||
9 | </sectionGroup> | ||
10 | </configSections> | ||
11 | <startup> | ||
12 | <supportedRuntime version="v2.0.50727" /> | ||
13 | </startup> | ||
14 | <wix.bootstrapper> | ||
15 | |||
16 | <host assemblyName="Example.FullFramework2MBA"> | ||
17 | <supportedFramework version="v3.5" /> | ||
18 | </host> | ||
19 | </wix.bootstrapper> | ||
20 | </configuration> | ||
diff --git a/src/ext/Bal/test/examples/FullFramework4Bundle/Bundle.wxs b/src/ext/Bal/test/examples/FullFramework4Bundle/Bundle.wxs new file mode 100644 index 00000000..7b7cbf57 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4Bundle/Bundle.wxs | |||
@@ -0,0 +1,14 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
2 | <Bundle Name="FullFramework4MBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="E08068E0-4FBA-439D-A1C8-4CD1FE27093F"> | ||
3 | <BootstrapperApplication> | ||
4 | <Payload SourceFile="Example.FullFramework4MBA\net48\win-x86\Example.FullFramework4MBA.dll" /> | ||
5 | <Payload SourceFile="Example.FullFramework4MBA\net48\win-x86\mbanative.dll" /> | ||
6 | <Payload SourceFile="Example.FullFramework4MBA\net48\win-x86\WixToolset.Mba.Core.dll" /> | ||
7 | <Payload SourceFile="Example.FullFramework4MBA\net48\win-x86\WixToolset.Mba.Host.config" /> | ||
8 | <bal:WixManagedBootstrapperApplicationHost /> | ||
9 | </BootstrapperApplication> | ||
10 | <Chain> | ||
11 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" bal:PrereqPackage="yes" /> | ||
12 | </Chain> | ||
13 | </Bundle> | ||
14 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/FullFramework4Bundle/FullFramework4Bundle.wixproj b/src/ext/Bal/test/examples/FullFramework4Bundle/FullFramework4Bundle.wixproj new file mode 100644 index 00000000..ba75a9ff --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4Bundle/FullFramework4Bundle.wixproj | |||
@@ -0,0 +1,2 @@ | |||
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 | <Project Sdk="WixToolset.Sdk" /> | ||
diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj b/src/ext/Bal/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj new file mode 100644 index 00000000..a05e7888 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj | |||
@@ -0,0 +1,19 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
5 | <PropertyGroup> | ||
6 | <TargetFramework>net48</TargetFramework> | ||
7 | <Description>Full Framework v4 MBA</Description> | ||
8 | <RuntimeIdentifier>win-x86</RuntimeIdentifier> | ||
9 | </PropertyGroup> | ||
10 | |||
11 | <ItemGroup> | ||
12 | <PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" /> | ||
13 | <PackageReference Include="WixToolset.Mba.Core" Version="4.0.*" PrivateAssets="All" /> | ||
14 | </ItemGroup> | ||
15 | |||
16 | <ItemGroup> | ||
17 | <Content Include="WixToolset.Mba.Host.config" CopyToOutputDirectory="PreserveNewest" /> | ||
18 | </ItemGroup> | ||
19 | </Project> \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BA.cs b/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BA.cs new file mode 100644 index 00000000..8ee3bd19 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BA.cs | |||
@@ -0,0 +1,34 @@ | |||
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 Example.FullFramework4MBA | ||
4 | { | ||
5 | using WixToolset.Mba.Core; | ||
6 | |||
7 | public class FullFramework4BA : BootstrapperApplication | ||
8 | { | ||
9 | public FullFramework4BA(IEngine engine) | ||
10 | : base(engine) | ||
11 | { | ||
12 | |||
13 | } | ||
14 | |||
15 | protected override void Run() | ||
16 | { | ||
17 | } | ||
18 | |||
19 | protected override void OnStartup(StartupEventArgs args) | ||
20 | { | ||
21 | base.OnStartup(args); | ||
22 | |||
23 | this.engine.Log(LogLevel.Standard, nameof(FullFramework4BA)); | ||
24 | } | ||
25 | |||
26 | protected override void OnShutdown(ShutdownEventArgs args) | ||
27 | { | ||
28 | base.OnShutdown(args); | ||
29 | |||
30 | var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); | ||
31 | this.engine.Log(LogLevel.Standard, message); | ||
32 | } | ||
33 | } | ||
34 | } | ||
diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs b/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs new file mode 100644 index 00000000..6a571a54 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs | |||
@@ -0,0 +1,22 @@ | |||
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 | [assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Example.FullFramework4MBA.FullFramework4BAFactory))] | ||
4 | namespace Example.FullFramework4MBA | ||
5 | { | ||
6 | using WixToolset.Mba.Core; | ||
7 | |||
8 | public class FullFramework4BAFactory : BaseBootstrapperApplicationFactory | ||
9 | { | ||
10 | private static int loadCount = 0; | ||
11 | |||
12 | protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) | ||
13 | { | ||
14 | if (loadCount > 0) | ||
15 | { | ||
16 | engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)"); | ||
17 | } | ||
18 | ++loadCount; | ||
19 | return new FullFramework4BA(engine); | ||
20 | } | ||
21 | } | ||
22 | } | ||
diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config b/src/ext/Bal/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config new file mode 100644 index 00000000..96678cda --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config | |||
@@ -0,0 +1,17 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | |||
5 | <configuration> | ||
6 | <configSections> | ||
7 | <sectionGroup name="wix.bootstrapper" type="WixToolset.Mba.Host.BootstrapperSectionGroup, WixToolset.Mba.Host"> | ||
8 | <section name="host" type="WixToolset.Mba.Host.HostSection, WixToolset.Mba.Host" /> | ||
9 | </sectionGroup> | ||
10 | </configSections> | ||
11 | <startup> | ||
12 | <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /> | ||
13 | </startup> | ||
14 | <wix.bootstrapper> | ||
15 | <host assemblyName="Example.FullFramework4MBA" /> | ||
16 | </wix.bootstrapper> | ||
17 | </configuration> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs b/src/ext/Bal/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs new file mode 100644 index 00000000..d5b543e8 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs | |||
@@ -0,0 +1,16 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
2 | <Bundle Name="FDDLatestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
3 | <BootstrapperApplication> | ||
4 | <Payload SourceFile="publish\Example.LatestCoreMBA\fdd\Example.LatestCoreMBA.deps.json" Name="Example.LatestCoreMBA.deps.json" /> | ||
5 | <Payload SourceFile="publish\Example.LatestCoreMBA\fdd\Example.LatestCoreMBA.dll" Name="Example.LatestCoreMBA.dll" bal:BAFactoryAssembly="yes" /> | ||
6 | <Payload SourceFile="publish\Example.LatestCoreMBA\fdd\Example.LatestCoreMBA.pdb" Name="Example.LatestCoreMBA.pdb" /> | ||
7 | <Payload SourceFile="publish\Example.LatestCoreMBA\fdd\Example.LatestCoreMBA.runtimeconfig.json" Name="Example.LatestCoreMBA.runtimeconfig.json" /> | ||
8 | <Payload SourceFile="publish\Example.LatestCoreMBA\fdd\mbanative.dll" Name="mbanative.dll" /> | ||
9 | <Payload SourceFile="publish\Example.LatestCoreMBA\fdd\WixToolset.Mba.Core.dll" Name="WixToolset.Mba.Core.dll" /> | ||
10 | <bal:WixDotNetCoreBootstrapperApplicationHost /> | ||
11 | </BootstrapperApplication> | ||
12 | <Chain> | ||
13 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" bal:PrereqPackage="yes" /> | ||
14 | </Chain> | ||
15 | </Bundle> | ||
16 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreBundleFDD/LatestCoreBundleFDD.wixproj b/src/ext/Bal/test/examples/LatestCoreBundleFDD/LatestCoreBundleFDD.wixproj new file mode 100644 index 00000000..ba75a9ff --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleFDD/LatestCoreBundleFDD.wixproj | |||
@@ -0,0 +1,2 @@ | |||
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 | <Project Sdk="WixToolset.Sdk" /> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreBundleSCD/LatestCoreBundleSCD.wixproj b/src/ext/Bal/test/examples/LatestCoreBundleSCD/LatestCoreBundleSCD.wixproj new file mode 100644 index 00000000..30a860ab --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleSCD/LatestCoreBundleSCD.wixproj | |||
@@ -0,0 +1,10 @@ | |||
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 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <ItemGroup> | ||
4 | <BindInputPaths Include="$(OutputPath)publish\Example.LatestCoreMBA\scd" /> | ||
5 | <HarvestDirectory Include="$(OutputPath)publish\Example.LatestCoreMBA\scd"> | ||
6 | <DirectoryRefId>publish.Example.LatestCoreMBA.scd</DirectoryRefId> | ||
7 | <Transforms>ba.xslt</Transforms> | ||
8 | </HarvestDirectory> | ||
9 | </ItemGroup> | ||
10 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs b/src/ext/Bal/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs new file mode 100644 index 00000000..bedf0326 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs | |||
@@ -0,0 +1,11 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
2 | <Bundle Name="SCDLatestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
3 | <BootstrapperApplication> | ||
4 | <bal:WixDotNetCoreBootstrapperApplicationHost SelfContainedDeployment="yes" /> | ||
5 | <PayloadGroupRef Id="publish.Example.LatestCoreMBA.scd" /> | ||
6 | </BootstrapperApplication> | ||
7 | <Chain> | ||
8 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" PerMachine="yes" /> | ||
9 | </Chain> | ||
10 | </Bundle> | ||
11 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreBundleSCD/ba.xslt b/src/ext/Bal/test/examples/LatestCoreBundleSCD/ba.xslt new file mode 100644 index 00000000..acc7474c --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleSCD/ba.xslt | |||
@@ -0,0 +1,20 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
3 | xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" | ||
4 | xmlns:wix="http://wixtoolset.org/schemas/v4/wxs" | ||
5 | > | ||
6 | <xsl:output method="xml" indent="yes"/> | ||
7 | |||
8 | <xsl:template match="@* | node()"> | ||
9 | <xsl:copy> | ||
10 | <xsl:apply-templates select="@* | node()"/> | ||
11 | </xsl:copy> | ||
12 | </xsl:template> | ||
13 | |||
14 | <xsl:template match="wix:Payload[@SourceFile='SourceDir\Example.LatestCoreMBA.dll']" > | ||
15 | <xsl:copy> | ||
16 | <xsl:attribute name="BAFactoryAssembly" namespace="http://wixtoolset.org/schemas/v4/wxs/bal">yes</xsl:attribute> | ||
17 | <xsl:apply-templates select="@* | node()"/> | ||
18 | </xsl:copy> | ||
19 | </xsl:template> | ||
20 | </xsl:stylesheet> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/LatestCoreBundleTrimmedSCD.wixproj b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/LatestCoreBundleTrimmedSCD.wixproj new file mode 100644 index 00000000..5ce89b64 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/LatestCoreBundleTrimmedSCD.wixproj | |||
@@ -0,0 +1,10 @@ | |||
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 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <ItemGroup> | ||
4 | <BindInputPaths Include="$(OutputPath)publish\Example.LatestCoreMBA\trimmedscd" /> | ||
5 | <HarvestDirectory Include="$(OutputPath)publish\Example.LatestCoreMBA\trimmedscd"> | ||
6 | <DirectoryRefId>publish.Example.LatestCoreMBA.trimmedscd</DirectoryRefId> | ||
7 | <Transforms>ba.xslt</Transforms> | ||
8 | </HarvestDirectory> | ||
9 | </ItemGroup> | ||
10 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs new file mode 100644 index 00000000..6059f8c1 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs | |||
@@ -0,0 +1,11 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
2 | <Bundle Name="TrimmedSCDLatestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
3 | <BootstrapperApplication> | ||
4 | <bal:WixDotNetCoreBootstrapperApplicationHost SelfContainedDeployment="yes" /> | ||
5 | <PayloadGroupRef Id="publish.Example.LatestCoreMBA.trimmedscd" /> | ||
6 | </BootstrapperApplication> | ||
7 | <Chain> | ||
8 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" PerMachine="yes" /> | ||
9 | </Chain> | ||
10 | </Bundle> | ||
11 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/ba.xslt b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/ba.xslt new file mode 100644 index 00000000..acc7474c --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/ba.xslt | |||
@@ -0,0 +1,20 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
3 | xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" | ||
4 | xmlns:wix="http://wixtoolset.org/schemas/v4/wxs" | ||
5 | > | ||
6 | <xsl:output method="xml" indent="yes"/> | ||
7 | |||
8 | <xsl:template match="@* | node()"> | ||
9 | <xsl:copy> | ||
10 | <xsl:apply-templates select="@* | node()"/> | ||
11 | </xsl:copy> | ||
12 | </xsl:template> | ||
13 | |||
14 | <xsl:template match="wix:Payload[@SourceFile='SourceDir\Example.LatestCoreMBA.dll']" > | ||
15 | <xsl:copy> | ||
16 | <xsl:attribute name="BAFactoryAssembly" namespace="http://wixtoolset.org/schemas/v4/wxs/bal">yes</xsl:attribute> | ||
17 | <xsl:apply-templates select="@* | node()"/> | ||
18 | </xsl:copy> | ||
19 | </xsl:template> | ||
20 | </xsl:stylesheet> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj b/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj new file mode 100644 index 00000000..9f3f02d9 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj | |||
@@ -0,0 +1,21 @@ | |||
1 | <Project Sdk="Microsoft.NET.Sdk"> | ||
2 | |||
3 | <PropertyGroup> | ||
4 | <TargetFramework>net5.0</TargetFramework> | ||
5 | <RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers> | ||
6 | <EnableDynamicLoading>true</EnableDynamicLoading> | ||
7 | <Description>Latest .NET Core MBA</Description> | ||
8 | </PropertyGroup> | ||
9 | |||
10 | <ItemGroup> | ||
11 | <TrimmerRootAssembly Include="System.Diagnostics.Tools" /> | ||
12 | <TrimmerRootAssembly Include="System.Runtime" /> | ||
13 | <TrimmerRootAssembly Include="System.Runtime.InteropServices" /> | ||
14 | <TrimmerRootAssembly Include="System.Runtime.Loader" /> | ||
15 | </ItemGroup> | ||
16 | |||
17 | <ItemGroup> | ||
18 | <PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" /> | ||
19 | <PackageReference Include="WixToolset.Mba.Core" Version="4.0.*" /> | ||
20 | </ItemGroup> | ||
21 | </Project> \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBA.cs b/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBA.cs new file mode 100644 index 00000000..50386a87 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBA.cs | |||
@@ -0,0 +1,33 @@ | |||
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 Example.LatestCoreMBA | ||
4 | { | ||
5 | using WixToolset.Mba.Core; | ||
6 | |||
7 | public class LatestCoreBA : BootstrapperApplication | ||
8 | { | ||
9 | public LatestCoreBA(IEngine engine) | ||
10 | : base(engine) | ||
11 | { | ||
12 | } | ||
13 | |||
14 | protected override void Run() | ||
15 | { | ||
16 | } | ||
17 | |||
18 | protected override void OnStartup(StartupEventArgs args) | ||
19 | { | ||
20 | base.OnStartup(args); | ||
21 | |||
22 | this.engine.Log(LogLevel.Standard, nameof(LatestCoreBA)); | ||
23 | } | ||
24 | |||
25 | protected override void OnShutdown(ShutdownEventArgs args) | ||
26 | { | ||
27 | base.OnShutdown(args); | ||
28 | |||
29 | var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); | ||
30 | this.engine.Log(LogLevel.Standard, message); | ||
31 | } | ||
32 | } | ||
33 | } | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs b/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs new file mode 100644 index 00000000..fff3b5c5 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs | |||
@@ -0,0 +1,22 @@ | |||
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 | [assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Example.LatestCoreMBA.LatestCoreBAFactory))] | ||
4 | namespace Example.LatestCoreMBA | ||
5 | { | ||
6 | using WixToolset.Mba.Core; | ||
7 | |||
8 | public class LatestCoreBAFactory : BaseBootstrapperApplicationFactory | ||
9 | { | ||
10 | private static int loadCount = 0; | ||
11 | |||
12 | protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) | ||
13 | { | ||
14 | if (loadCount > 0) | ||
15 | { | ||
16 | engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)"); | ||
17 | } | ||
18 | ++loadCount; | ||
19 | return new LatestCoreBA(engine); | ||
20 | } | ||
21 | } | ||
22 | } | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/Example.TestEngine.vcxproj b/src/ext/Bal/test/examples/TestEngine/Example.TestEngine.vcxproj new file mode 100644 index 00000000..99eb917e --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/Example.TestEngine.vcxproj | |||
@@ -0,0 +1,83 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
4 | <Import Project="..\..\..\..\packages\WixToolset.BalUtil.4.0.58\build\WixToolset.BalUtil.props" Condition="Exists('..\..\..\..\packages\WixToolset.BalUtil.4.0.58\build\WixToolset.BalUtil.props')" /> | ||
5 | <Import Project="..\..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props')" /> | ||
6 | <Import Project="..\..\..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props" Condition="Exists('..\..\..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props')" /> | ||
7 | <ItemGroup Label="ProjectConfigurations"> | ||
8 | <ProjectConfiguration Include="Debug|ARM64"> | ||
9 | <Configuration>Debug</Configuration> | ||
10 | <Platform>ARM64</Platform> | ||
11 | </ProjectConfiguration> | ||
12 | <ProjectConfiguration Include="Release|ARM64"> | ||
13 | <Configuration>Release</Configuration> | ||
14 | <Platform>ARM64</Platform> | ||
15 | </ProjectConfiguration> | ||
16 | <ProjectConfiguration Include="Debug|Win32"> | ||
17 | <Configuration>Debug</Configuration> | ||
18 | <Platform>Win32</Platform> | ||
19 | </ProjectConfiguration> | ||
20 | <ProjectConfiguration Include="Release|Win32"> | ||
21 | <Configuration>Release</Configuration> | ||
22 | <Platform>Win32</Platform> | ||
23 | </ProjectConfiguration> | ||
24 | <ProjectConfiguration Include="Debug|x64"> | ||
25 | <Configuration>Debug</Configuration> | ||
26 | <Platform>x64</Platform> | ||
27 | </ProjectConfiguration> | ||
28 | <ProjectConfiguration Include="Release|x64"> | ||
29 | <Configuration>Release</Configuration> | ||
30 | <Platform>x64</Platform> | ||
31 | </ProjectConfiguration> | ||
32 | </ItemGroup> | ||
33 | <PropertyGroup Label="Globals"> | ||
34 | <ProjectGuid>{3D44B67D-A475-49BA-8310-E39F6C117CC9}</ProjectGuid> | ||
35 | <ConfigurationType>Application</ConfigurationType> | ||
36 | <ProjectSubSystem>Console</ProjectSubSystem> | ||
37 | <TargetName>Example.TestEngine</TargetName> | ||
38 | <PlatformToolset>v142</PlatformToolset> | ||
39 | <CharacterSet>Unicode</CharacterSet> | ||
40 | <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> | ||
41 | </PropertyGroup> | ||
42 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
43 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
44 | <ImportGroup Label="ExtensionSettings"> | ||
45 | </ImportGroup> | ||
46 | <ImportGroup Label="Shared"> | ||
47 | <Import Project="..\..\..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" /> | ||
48 | </ImportGroup> | ||
49 | <PropertyGroup> | ||
50 | <ProjectAdditionalLinkLibraries> | ||
51 | </ProjectAdditionalLinkLibraries> | ||
52 | </PropertyGroup> | ||
53 | <ItemGroup> | ||
54 | <ClCompile Include="precomp.cpp"> | ||
55 | <PrecompiledHeader>Create</PrecompiledHeader> | ||
56 | </ClCompile> | ||
57 | <ClCompile Include="ReloadEngine.cpp" /> | ||
58 | <ClCompile Include="ShutdownEngine.cpp" /> | ||
59 | <ClCompile Include="ExampleTestEngine.cpp" /> | ||
60 | <ClCompile Include="TestEngine.cpp" /> | ||
61 | <ClCompile Include="WaitForQuitEngine.cpp" /> | ||
62 | </ItemGroup> | ||
63 | <ItemGroup> | ||
64 | <ClInclude Include="precomp.h" /> | ||
65 | <ClInclude Include="ReloadEngine.h" /> | ||
66 | <ClInclude Include="ShutdownEngine.h" /> | ||
67 | <ClInclude Include="TestEngine.h" /> | ||
68 | <ClInclude Include="WaitForQuitEngine.h" /> | ||
69 | </ItemGroup> | ||
70 | <ItemGroup> | ||
71 | <None Include="packages.config" /> | ||
72 | </ItemGroup> | ||
73 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
74 | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
75 | <PropertyGroup> | ||
76 | <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
77 | </PropertyGroup> | ||
78 | <Error Condition="!Exists('..\..\..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets'))" /> | ||
79 | <Error Condition="!Exists('..\..\..\..\packages\WixToolset.BalUtil.4.0.58\build\WixToolset.BalUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.BalUtil.4.0.58\build\WixToolset.BalUtil.props'))" /> | ||
80 | <Error Condition="!Exists('..\..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props'))" /> | ||
81 | <Error Condition="!Exists('..\..\..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props'))" /> | ||
82 | </Target> | ||
83 | </Project> \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/ExampleTestEngine.cpp b/src/ext/Bal/test/examples/TestEngine/ExampleTestEngine.cpp new file mode 100644 index 00000000..fc1938fe --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/ExampleTestEngine.cpp | |||
@@ -0,0 +1,53 @@ | |||
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 | #include "precomp.h" | ||
4 | |||
5 | int __cdecl wmain(int argc, LPWSTR argv[]) | ||
6 | { | ||
7 | HRESULT hr = S_OK; | ||
8 | BOOL fComInitialized = FALSE; | ||
9 | BOOL fShowUsage = FALSE; | ||
10 | |||
11 | // initialize COM | ||
12 | hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); | ||
13 | ExitOnFailure(hr, "Failed to initialize COM."); | ||
14 | fComInitialized = TRUE; | ||
15 | |||
16 | ConsoleInitialize(); | ||
17 | |||
18 | if (argc != 4) | ||
19 | { | ||
20 | fShowUsage = TRUE; | ||
21 | } | ||
22 | else if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, argv[1], -1, L"reload", -1)) | ||
23 | { | ||
24 | hr = RunReloadEngine(argv[2], argv[3]); | ||
25 | } | ||
26 | else if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, argv[1], -1, L"shutdown", -1)) | ||
27 | { | ||
28 | hr = RunShutdownEngine(argv[2], argv[3]); | ||
29 | } | ||
30 | else if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, argv[1], -1, L"waitforquit", -1)) | ||
31 | { | ||
32 | hr = RunWaitForQuitEngine(argv[2], argv[3]); | ||
33 | } | ||
34 | else | ||
35 | { | ||
36 | fShowUsage = TRUE; | ||
37 | } | ||
38 | |||
39 | if (fShowUsage) | ||
40 | { | ||
41 | ConsoleWriteError(hr = E_INVALIDARG, CONSOLE_COLOR_RED, "Usage: Example.TestEngine.exe {reload|shutdown|waitforquit} Bundle.exe BA.dll"); | ||
42 | } | ||
43 | |||
44 | ConsoleUninitialize(); | ||
45 | |||
46 | LExit: | ||
47 | if (fComInitialized) | ||
48 | { | ||
49 | ::CoUninitialize(); | ||
50 | } | ||
51 | |||
52 | return hr; | ||
53 | } | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/ReloadEngine.cpp b/src/ext/Bal/test/examples/TestEngine/ReloadEngine.cpp new file mode 100644 index 00000000..46fd9afa --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/ReloadEngine.cpp | |||
@@ -0,0 +1,55 @@ | |||
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 | #include "precomp.h" | ||
4 | |||
5 | HRESULT RunReloadEngine( | ||
6 | __in LPCWSTR wzBundleFilePath, | ||
7 | __in LPCWSTR wzBAFilePath | ||
8 | ) | ||
9 | { | ||
10 | HRESULT hr = S_OK; | ||
11 | TestEngine* pTestEngine = NULL; | ||
12 | |||
13 | pTestEngine = new TestEngine(); | ||
14 | ConsoleExitOnNull(pTestEngine, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to create new test engine."); | ||
15 | |||
16 | hr = pTestEngine->Initialize(wzBundleFilePath); | ||
17 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to initialize engine."); | ||
18 | |||
19 | hr = pTestEngine->LoadBA(wzBAFilePath); | ||
20 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA."); | ||
21 | |||
22 | hr = pTestEngine->SendStartupEvent(); | ||
23 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnStartup."); | ||
24 | |||
25 | hr = pTestEngine->SimulateQuit(0); | ||
26 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to simulate quit."); | ||
27 | |||
28 | hr = pTestEngine->RunApplication(); | ||
29 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to run engine."); | ||
30 | |||
31 | hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER); | ||
32 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown."); | ||
33 | |||
34 | pTestEngine->UnloadBA(); | ||
35 | |||
36 | hr = pTestEngine->LoadBA(wzBAFilePath); | ||
37 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA."); | ||
38 | |||
39 | hr = pTestEngine->SendStartupEvent(); | ||
40 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnStartup."); | ||
41 | |||
42 | hr = pTestEngine->SimulateQuit(0); | ||
43 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to simulate quit."); | ||
44 | |||
45 | hr = pTestEngine->RunApplication(); | ||
46 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to run engine."); | ||
47 | |||
48 | hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RESTART); | ||
49 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown."); | ||
50 | |||
51 | pTestEngine->UnloadBA(); | ||
52 | |||
53 | LExit: | ||
54 | return hr; | ||
55 | } | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/ReloadEngine.h b/src/ext/Bal/test/examples/TestEngine/ReloadEngine.h new file mode 100644 index 00000000..0e8456af --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/ReloadEngine.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | HRESULT RunReloadEngine( | ||
6 | __in LPCWSTR wzBundleFilePath, | ||
7 | __in LPCWSTR wzBAFilePath | ||
8 | ); | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.cpp b/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.cpp new file mode 100644 index 00000000..3b876e4e --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.cpp | |||
@@ -0,0 +1,38 @@ | |||
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 | #include "precomp.h" | ||
4 | |||
5 | HRESULT RunShutdownEngine( | ||
6 | __in LPCWSTR wzBundleFilePath, | ||
7 | __in LPCWSTR wzBAFilePath | ||
8 | ) | ||
9 | { | ||
10 | HRESULT hr = S_OK; | ||
11 | TestEngine* pTestEngine = NULL; | ||
12 | |||
13 | pTestEngine = new TestEngine(); | ||
14 | ConsoleExitOnNull(pTestEngine, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to create new test engine."); | ||
15 | |||
16 | hr = pTestEngine->Initialize(wzBundleFilePath); | ||
17 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to initialize engine."); | ||
18 | |||
19 | hr = pTestEngine->LoadBA(wzBAFilePath); | ||
20 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA."); | ||
21 | |||
22 | hr = pTestEngine->SendStartupEvent(); | ||
23 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnStartup."); | ||
24 | |||
25 | hr = pTestEngine->SimulateQuit(0); | ||
26 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to simulate quit."); | ||
27 | |||
28 | hr = pTestEngine->RunApplication(); | ||
29 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to run engine."); | ||
30 | |||
31 | hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER); | ||
32 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown."); | ||
33 | |||
34 | pTestEngine->UnloadBA(); | ||
35 | |||
36 | LExit: | ||
37 | return hr; | ||
38 | } | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.h b/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.h new file mode 100644 index 00000000..0cfa147a --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | HRESULT RunShutdownEngine( | ||
6 | __in LPCWSTR wzBundleFilePath, | ||
7 | __in LPCWSTR wzBAFilePath | ||
8 | ); | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp b/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp new file mode 100644 index 00000000..4c7ec1c3 --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp | |||
@@ -0,0 +1,256 @@ | |||
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 | #include "precomp.h" | ||
4 | |||
5 | HRESULT TestEngine::Initialize( | ||
6 | __in LPCWSTR wzBundleFilePath | ||
7 | ) | ||
8 | { | ||
9 | HRESULT hr = S_OK; | ||
10 | MSG msg = { }; | ||
11 | |||
12 | LogInitialize(::GetModuleHandleW(NULL)); | ||
13 | |||
14 | hr = LogOpen(NULL, PathFile(wzBundleFilePath), NULL, L"txt", FALSE, FALSE, NULL); | ||
15 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to open log."); | ||
16 | |||
17 | ::PeekMessageW(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE); | ||
18 | |||
19 | LExit: | ||
20 | return hr; | ||
21 | } | ||
22 | |||
23 | HRESULT TestEngine::LoadBA( | ||
24 | __in LPCWSTR wzBAFilePath | ||
25 | ) | ||
26 | { | ||
27 | HRESULT hr = S_OK; | ||
28 | BOOTSTRAPPER_COMMAND command = { }; | ||
29 | BOOTSTRAPPER_CREATE_ARGS args = { }; | ||
30 | PFN_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = NULL; | ||
31 | |||
32 | if (m_pCreateResults || m_hBAModule) | ||
33 | { | ||
34 | ExitFunction1(hr = E_INVALIDSTATE); | ||
35 | } | ||
36 | |||
37 | m_pCreateResults = static_cast<BOOTSTRAPPER_CREATE_RESULTS*>(MemAlloc(sizeof(BOOTSTRAPPER_CREATE_RESULTS), TRUE)); | ||
38 | |||
39 | command.cbSize = sizeof(BOOTSTRAPPER_COMMAND); | ||
40 | |||
41 | hr = PathGetDirectory(wzBAFilePath, &command.wzBootstrapperWorkingFolder); | ||
42 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to allocate wzBootstrapperWorkingFolder"); | ||
43 | |||
44 | hr = PathConcat(command.wzBootstrapperWorkingFolder, L"BootstrapperApplicationData.xml", &command.wzBootstrapperApplicationDataPath); | ||
45 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to allocate wzBootstrapperApplicationDataPath"); | ||
46 | |||
47 | args.cbSize = sizeof(BOOTSTRAPPER_CREATE_ARGS); | ||
48 | args.pCommand = &command; | ||
49 | args.pfnBootstrapperEngineProc = TestEngine::EngineProc; | ||
50 | args.pvBootstrapperEngineProcContext = this; | ||
51 | args.qwEngineAPIVersion = MAKEQWORDVERSION(0, 0, 0, 1); | ||
52 | |||
53 | m_pCreateResults->cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS); | ||
54 | |||
55 | m_hBAModule = ::LoadLibraryExW(wzBAFilePath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); | ||
56 | ConsoleExitOnNullWithLastError(m_hBAModule, hr, CONSOLE_COLOR_RED, "Failed to load BA dll."); | ||
57 | |||
58 | pfnCreate = (PFN_BOOTSTRAPPER_APPLICATION_CREATE)::GetProcAddress(m_hBAModule, "BootstrapperApplicationCreate"); | ||
59 | ConsoleExitOnNull(pfnCreate, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to get address for BootstrapperApplicationCreate."); | ||
60 | |||
61 | hr = pfnCreate(&args, m_pCreateResults); | ||
62 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure on BootstrapperApplicationCreate."); | ||
63 | |||
64 | LExit: | ||
65 | ReleaseStr(command.wzBootstrapperApplicationDataPath); | ||
66 | ReleaseStr(command.wzBootstrapperWorkingFolder); | ||
67 | |||
68 | return hr; | ||
69 | } | ||
70 | |||
71 | HRESULT TestEngine::Log( | ||
72 | __in BOOTSTRAPPER_LOG_LEVEL level, | ||
73 | __in LPCWSTR wzMessage | ||
74 | ) | ||
75 | { | ||
76 | switch (level) | ||
77 | { | ||
78 | case BOOTSTRAPPER_LOG_LEVEL_NONE: | ||
79 | case BOOTSTRAPPER_LOG_LEVEL_DEBUG: | ||
80 | return S_OK; | ||
81 | default: | ||
82 | LogStringLine(REPORT_STANDARD, "%ls", wzMessage); | ||
83 | return ConsoleWriteLine(CONSOLE_COLOR_NORMAL, "%ls", wzMessage); | ||
84 | } | ||
85 | } | ||
86 | |||
87 | HRESULT TestEngine::RunApplication() | ||
88 | { | ||
89 | HRESULT hr = S_OK; | ||
90 | MSG msg = { }; | ||
91 | BOOL fRet = FALSE; | ||
92 | |||
93 | // Enter the message pump. | ||
94 | while (0 != (fRet = ::GetMessageW(&msg, NULL, 0, 0))) | ||
95 | { | ||
96 | if (-1 == fRet) | ||
97 | { | ||
98 | ConsoleExitOnFailure(hr = E_UNEXPECTED, CONSOLE_COLOR_RED, "Unexpected return value from message pump."); | ||
99 | } | ||
100 | else | ||
101 | { | ||
102 | ProcessBAMessage(&msg); | ||
103 | } | ||
104 | } | ||
105 | |||
106 | LExit: | ||
107 | return hr; | ||
108 | } | ||
109 | |||
110 | HRESULT TestEngine::SendShutdownEvent( | ||
111 | __in BOOTSTRAPPER_SHUTDOWN_ACTION defaultAction | ||
112 | ) | ||
113 | { | ||
114 | HRESULT hr = S_OK; | ||
115 | BA_ONSHUTDOWN_ARGS shutdownArgs = { }; | ||
116 | BA_ONSHUTDOWN_RESULTS shutdownResults = { }; | ||
117 | shutdownArgs.cbSize = sizeof(BA_ONSHUTDOWN_ARGS); | ||
118 | shutdownResults.action = defaultAction; | ||
119 | shutdownResults.cbSize = sizeof(BA_ONSHUTDOWN_RESULTS); | ||
120 | hr = m_pCreateResults->pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, &shutdownArgs, &shutdownResults, m_pCreateResults->pvBootstrapperApplicationProcContext); | ||
121 | return hr; | ||
122 | } | ||
123 | |||
124 | HRESULT TestEngine::SendStartupEvent() | ||
125 | { | ||
126 | HRESULT hr = S_OK; | ||
127 | BA_ONSTARTUP_ARGS startupArgs = { }; | ||
128 | BA_ONSTARTUP_RESULTS startupResults = { }; | ||
129 | startupArgs.cbSize = sizeof(BA_ONSTARTUP_ARGS); | ||
130 | startupResults.cbSize = sizeof(BA_ONSTARTUP_RESULTS); | ||
131 | hr = m_pCreateResults->pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, &startupArgs, &startupResults, m_pCreateResults->pvBootstrapperApplicationProcContext); | ||
132 | return hr; | ||
133 | } | ||
134 | |||
135 | HRESULT TestEngine::SimulateQuit( | ||
136 | __in DWORD dwExitCode | ||
137 | ) | ||
138 | { | ||
139 | BAENGINE_QUIT_ARGS args = { }; | ||
140 | BAENGINE_QUIT_RESULTS results = { }; | ||
141 | |||
142 | args.cbSize = sizeof(BAENGINE_QUIT_ARGS); | ||
143 | args.dwExitCode = dwExitCode; | ||
144 | |||
145 | results.cbSize = sizeof(BAENGINE_QUIT_RESULTS); | ||
146 | |||
147 | return BAEngineQuit(&args, &results); | ||
148 | } | ||
149 | |||
150 | void TestEngine::UnloadBA() | ||
151 | { | ||
152 | PFN_BOOTSTRAPPER_APPLICATION_DESTROY pfnDestroy = NULL; | ||
153 | BOOL fDisableUnloading = m_pCreateResults && m_pCreateResults->fDisableUnloading; | ||
154 | |||
155 | ReleaseNullMem(m_pCreateResults); | ||
156 | |||
157 | pfnDestroy = (PFN_BOOTSTRAPPER_APPLICATION_DESTROY)::GetProcAddress(m_hBAModule, "BootstrapperApplicationDestroy"); | ||
158 | |||
159 | if (pfnDestroy) | ||
160 | { | ||
161 | pfnDestroy(); | ||
162 | } | ||
163 | |||
164 | if (m_hBAModule) | ||
165 | { | ||
166 | if (!fDisableUnloading) | ||
167 | { | ||
168 | ::FreeLibrary(m_hBAModule); | ||
169 | } | ||
170 | |||
171 | m_hBAModule = NULL; | ||
172 | } | ||
173 | } | ||
174 | |||
175 | HRESULT TestEngine::BAEngineLog( | ||
176 | __in BAENGINE_LOG_ARGS* pArgs, | ||
177 | __in BAENGINE_LOG_RESULTS* /*pResults*/ | ||
178 | ) | ||
179 | { | ||
180 | return Log(pArgs->level, pArgs->wzMessage); | ||
181 | } | ||
182 | |||
183 | HRESULT TestEngine::BAEngineQuit( | ||
184 | __in BAENGINE_QUIT_ARGS* pArgs, | ||
185 | __in BAENGINE_QUIT_RESULTS* /*pResults*/ | ||
186 | ) | ||
187 | { | ||
188 | HRESULT hr = S_OK; | ||
189 | |||
190 | if (!::PostThreadMessageW(m_dwThreadId, WM_TESTENG_QUIT, static_cast<WPARAM>(pArgs->dwExitCode), 0)) | ||
191 | { | ||
192 | ConsoleExitWithLastError(hr, CONSOLE_COLOR_RED, "Failed to post shutdown message."); | ||
193 | } | ||
194 | |||
195 | LExit: | ||
196 | return hr; | ||
197 | } | ||
198 | |||
199 | HRESULT WINAPI TestEngine::EngineProc( | ||
200 | __in BOOTSTRAPPER_ENGINE_MESSAGE message, | ||
201 | __in const LPVOID pvArgs, | ||
202 | __inout LPVOID pvResults, | ||
203 | __in_opt LPVOID pvContext | ||
204 | ) | ||
205 | { | ||
206 | HRESULT hr = S_OK; | ||
207 | TestEngine* pContext = (TestEngine*)pvContext; | ||
208 | |||
209 | if (!pContext || !pvArgs || !pvResults) | ||
210 | { | ||
211 | ExitFunction1(hr = E_INVALIDARG); | ||
212 | } | ||
213 | |||
214 | switch (message) | ||
215 | { | ||
216 | case BOOTSTRAPPER_ENGINE_MESSAGE_LOG: | ||
217 | hr = pContext->BAEngineLog(reinterpret_cast<BAENGINE_LOG_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_LOG_RESULTS*>(pvResults)); | ||
218 | break; | ||
219 | case BOOTSTRAPPER_ENGINE_MESSAGE_QUIT: | ||
220 | hr = pContext->BAEngineQuit(reinterpret_cast<BAENGINE_QUIT_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_QUIT_RESULTS*>(pvResults)); | ||
221 | default: | ||
222 | hr = E_NOTIMPL; | ||
223 | break; | ||
224 | } | ||
225 | |||
226 | LExit: | ||
227 | return hr; | ||
228 | } | ||
229 | |||
230 | HRESULT TestEngine::ProcessBAMessage( | ||
231 | __in const MSG* pmsg | ||
232 | ) | ||
233 | { | ||
234 | HRESULT hr = S_OK; | ||
235 | |||
236 | switch (pmsg->message) | ||
237 | { | ||
238 | case WM_TESTENG_QUIT: | ||
239 | ::PostQuitMessage(static_cast<int>(pmsg->wParam)); // go bye-bye. | ||
240 | break; | ||
241 | } | ||
242 | |||
243 | return hr; | ||
244 | } | ||
245 | |||
246 | TestEngine::TestEngine() | ||
247 | { | ||
248 | m_hBAModule = NULL; | ||
249 | m_pCreateResults = NULL; | ||
250 | m_dwThreadId = ::GetCurrentThreadId(); | ||
251 | } | ||
252 | |||
253 | TestEngine::~TestEngine() | ||
254 | { | ||
255 | ReleaseMem(m_pCreateResults); | ||
256 | } | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/TestEngine.h b/src/ext/Bal/test/examples/TestEngine/TestEngine.h new file mode 100644 index 00000000..44e813bd --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/TestEngine.h | |||
@@ -0,0 +1,80 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | enum WM_TESTENG | ||
6 | { | ||
7 | WM_TESTENG_FIRST = WM_APP + 0xFFF, // this enum value must always be first. | ||
8 | |||
9 | WM_TESTENG_DETECT, | ||
10 | WM_TESTENG_PLAN, | ||
11 | WM_TESTENG_ELEVATE, | ||
12 | WM_TESTENG_APPLY, | ||
13 | WM_TESTENG_LAUNCH_APPROVED_EXE, | ||
14 | WM_TESTENG_QUIT, | ||
15 | |||
16 | WM_TESTENG_LAST, // this enum value must always be last. | ||
17 | }; | ||
18 | |||
19 | class TestEngine | ||
20 | { | ||
21 | public: | ||
22 | HRESULT Initialize( | ||
23 | __in LPCWSTR wzBundleFilePath | ||
24 | ); | ||
25 | |||
26 | HRESULT LoadBA( | ||
27 | __in LPCWSTR wzBAFilePath | ||
28 | ); | ||
29 | |||
30 | HRESULT Log( | ||
31 | __in BOOTSTRAPPER_LOG_LEVEL level, | ||
32 | __in LPCWSTR wzMessage | ||
33 | ); | ||
34 | |||
35 | HRESULT RunApplication(); | ||
36 | |||
37 | HRESULT SendShutdownEvent( | ||
38 | __in BOOTSTRAPPER_SHUTDOWN_ACTION defaultAction | ||
39 | ); | ||
40 | |||
41 | HRESULT SendStartupEvent(); | ||
42 | |||
43 | HRESULT SimulateQuit( | ||
44 | __in DWORD dwExitCode | ||
45 | ); | ||
46 | |||
47 | void UnloadBA(); | ||
48 | |||
49 | private: | ||
50 | HRESULT BAEngineLog( | ||
51 | __in BAENGINE_LOG_ARGS* pArgs, | ||
52 | __in BAENGINE_LOG_RESULTS* pResults | ||
53 | ); | ||
54 | |||
55 | HRESULT BAEngineQuit( | ||
56 | __in BAENGINE_QUIT_ARGS* pArgs, | ||
57 | __in BAENGINE_QUIT_RESULTS* pResults | ||
58 | ); | ||
59 | |||
60 | static HRESULT WINAPI EngineProc( | ||
61 | __in BOOTSTRAPPER_ENGINE_MESSAGE message, | ||
62 | __in const LPVOID pvArgs, | ||
63 | __inout LPVOID pvResults, | ||
64 | __in_opt LPVOID pvContext | ||
65 | ); | ||
66 | |||
67 | HRESULT ProcessBAMessage( | ||
68 | __in const MSG* pmsg | ||
69 | ); | ||
70 | |||
71 | public: | ||
72 | TestEngine(); | ||
73 | |||
74 | ~TestEngine(); | ||
75 | |||
76 | private: | ||
77 | HMODULE m_hBAModule; | ||
78 | BOOTSTRAPPER_CREATE_RESULTS* m_pCreateResults; | ||
79 | DWORD m_dwThreadId; | ||
80 | }; \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.cpp b/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.cpp new file mode 100644 index 00000000..2f80ba75 --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.cpp | |||
@@ -0,0 +1,35 @@ | |||
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 | #include "precomp.h" | ||
4 | |||
5 | HRESULT RunWaitForQuitEngine( | ||
6 | __in LPCWSTR wzBundleFilePath, | ||
7 | __in LPCWSTR wzBAFilePath | ||
8 | ) | ||
9 | { | ||
10 | HRESULT hr = S_OK; | ||
11 | TestEngine* pTestEngine = NULL; | ||
12 | |||
13 | pTestEngine = new TestEngine(); | ||
14 | ConsoleExitOnNull(pTestEngine, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to create new test engine."); | ||
15 | |||
16 | hr = pTestEngine->Initialize(wzBundleFilePath); | ||
17 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to initialize engine."); | ||
18 | |||
19 | hr = pTestEngine->LoadBA(wzBAFilePath); | ||
20 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA."); | ||
21 | |||
22 | hr = pTestEngine->SendStartupEvent(); | ||
23 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnStartup."); | ||
24 | |||
25 | hr = pTestEngine->RunApplication(); | ||
26 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to run engine."); | ||
27 | |||
28 | hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER); | ||
29 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown."); | ||
30 | |||
31 | pTestEngine->UnloadBA(); | ||
32 | |||
33 | LExit: | ||
34 | return hr; | ||
35 | } | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.h b/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.h new file mode 100644 index 00000000..99e3f63c --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.h | |||
@@ -0,0 +1,8 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | |||
5 | HRESULT RunWaitForQuitEngine( | ||
6 | __in LPCWSTR wzBundleFilePath, | ||
7 | __in LPCWSTR wzBAFilePath | ||
8 | ); | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/packages.config b/src/ext/Bal/test/examples/TestEngine/packages.config new file mode 100644 index 00000000..548ddb48 --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/packages.config | |||
@@ -0,0 +1,7 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <packages> | ||
3 | <package id="Nerdbank.GitVersioning" version="3.3.37" targetFramework="native" developmentDependency="true" /> | ||
4 | <package id="WixToolset.BootstrapperCore.Native" version="4.0.141" targetFramework="native" /> | ||
5 | <package id="WixToolset.BalUtil" version="4.0.58" targetFramework="native" /> | ||
6 | <package id="WixToolset.DUtil" version="4.0.72" targetFramework="native" /> | ||
7 | </packages> \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/precomp.cpp b/src/ext/Bal/test/examples/TestEngine/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/precomp.cpp | |||
@@ -0,0 +1,3 @@ | |||
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 | #include "precomp.h" | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/precomp.h b/src/ext/Bal/test/examples/TestEngine/precomp.h new file mode 100644 index 00000000..f943f420 --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/precomp.h | |||
@@ -0,0 +1,20 @@ | |||
1 | #pragma once | ||
2 | // 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. | ||
3 | |||
4 | #include <windows.h> | ||
5 | #include <MsiQuery.h> | ||
6 | |||
7 | #include "dutil.h" | ||
8 | #include "conutil.h" | ||
9 | #include "logutil.h" | ||
10 | #include "memutil.h" | ||
11 | #include "pathutil.h" | ||
12 | #include "strutil.h" | ||
13 | |||
14 | #include "BootstrapperEngine.h" | ||
15 | #include "BootstrapperApplication.h" | ||
16 | |||
17 | #include "TestEngine.h" | ||
18 | #include "ReloadEngine.h" | ||
19 | #include "ShutdownEngine.h" | ||
20 | #include "WaitForQuitEngine.h" | ||
diff --git a/src/ext/Bal/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs b/src/ext/Bal/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs new file mode 100644 index 00000000..68d742b0 --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs | |||
@@ -0,0 +1,16 @@ | |||
1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
2 | <Bundle Name="FDDWPFCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
3 | <BootstrapperApplication> | ||
4 | <Payload SourceFile="publish\Example.WPFCoreMBA\fdd\Example.WPFCoreMBA.deps.json" Name="Example.WPFCoreMBA.deps.json" /> | ||
5 | <Payload SourceFile="publish\Example.WPFCoreMBA\fdd\Example.WPFCoreMBA.dll" Name="Example.WPFCoreMBA.dll" bal:BAFactoryAssembly="yes" /> | ||
6 | <Payload SourceFile="publish\Example.WPFCoreMBA\fdd\Example.WPFCoreMBA.pdb" Name="Example.WPFCoreMBA.pdb" /> | ||
7 | <Payload SourceFile="publish\Example.WPFCoreMBA\fdd\Example.WPFCoreMBA.runtimeconfig.json" Name="Example.WPFCoreMBA.runtimeconfig.json" /> | ||
8 | <Payload SourceFile="publish\Example.WPFCoreMBA\fdd\mbanative.dll" Name="mbanative.dll" /> | ||
9 | <Payload SourceFile="publish\Example.WPFCoreMBA\fdd\WixToolset.Mba.Core.dll" Name="WixToolset.Mba.Core.dll" /> | ||
10 | <bal:WixDotNetCoreBootstrapperApplicationHost /> | ||
11 | </BootstrapperApplication> | ||
12 | <Chain> | ||
13 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" bal:PrereqPackage="yes" /> | ||
14 | </Chain> | ||
15 | </Bundle> | ||
16 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/WPFCoreBundleFDD/WPFCoreBundleFDD.wixproj b/src/ext/Bal/test/examples/WPFCoreBundleFDD/WPFCoreBundleFDD.wixproj new file mode 100644 index 00000000..ba75a9ff --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreBundleFDD/WPFCoreBundleFDD.wixproj | |||
@@ -0,0 +1,2 @@ | |||
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 | <Project Sdk="WixToolset.Sdk" /> | ||
diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/AssemblyInfo.cs b/src/ext/Bal/test/examples/WPFCoreMBA/AssemblyInfo.cs new file mode 100644 index 00000000..03a5c7fa --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/AssemblyInfo.cs | |||
@@ -0,0 +1,12 @@ | |||
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 | using System.Windows; | ||
4 | |||
5 | [assembly:ThemeInfo( | ||
6 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | ||
7 | //(used if a resource is not found in the page, | ||
8 | // or application resource dictionaries) | ||
9 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | ||
10 | //(used if a resource is not found in the page, | ||
11 | // app, or any theme specific resource dictionaries) | ||
12 | )] | ||
diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj b/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj new file mode 100644 index 00000000..296e5be9 --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj | |||
@@ -0,0 +1,16 @@ | |||
1 | <Project Sdk="Microsoft.NET.Sdk"> | ||
2 | |||
3 | <PropertyGroup> | ||
4 | <TargetFramework>net5.0-windows</TargetFramework> | ||
5 | <RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers> | ||
6 | <EnableDynamicLoading>true</EnableDynamicLoading> | ||
7 | <Description>WPF .NET Core MBA</Description> | ||
8 | <UseWPF>true</UseWPF> | ||
9 | </PropertyGroup> | ||
10 | |||
11 | |||
12 | <ItemGroup> | ||
13 | <PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" /> | ||
14 | <PackageReference Include="WixToolset.Mba.Core" Version="4.0.*" /> | ||
15 | </ItemGroup> | ||
16 | </Project> \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml b/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml new file mode 100644 index 00000000..40a27a06 --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml | |||
@@ -0,0 +1,16 @@ | |||
1 | <?xml version="1.0" encoding="utf-8" ?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | |||
5 | <Window x:Class="Example.WPFCoreMBA.MainWindow" | ||
6 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
7 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
8 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
9 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
10 | xmlns:local="clr-namespace:Example.WPFCoreMBA" | ||
11 | mc:Ignorable="d" | ||
12 | Title="MainWindow" Height="450" Width="800"> | ||
13 | <Grid> | ||
14 | |||
15 | </Grid> | ||
16 | </Window> | ||
diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml.cs b/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml.cs new file mode 100644 index 00000000..4f61b807 --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml.cs | |||
@@ -0,0 +1,17 @@ | |||
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 Example.WPFCoreMBA | ||
4 | { | ||
5 | using System.Windows; | ||
6 | |||
7 | /// <summary> | ||
8 | /// Interaction logic for MainWindow.xaml | ||
9 | /// </summary> | ||
10 | public partial class MainWindow : Window | ||
11 | { | ||
12 | public MainWindow() | ||
13 | { | ||
14 | this.InitializeComponent(); | ||
15 | } | ||
16 | } | ||
17 | } | ||
diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBA.cs b/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBA.cs new file mode 100644 index 00000000..d50be813 --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBA.cs | |||
@@ -0,0 +1,42 @@ | |||
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 Example.WPFCoreMBA | ||
4 | { | ||
5 | using System.Windows.Threading; | ||
6 | using WixToolset.Mba.Core; | ||
7 | |||
8 | public class WPFCoreBA : BootstrapperApplication | ||
9 | { | ||
10 | public WPFCoreBA(IEngine engine) | ||
11 | : base(engine) | ||
12 | { | ||
13 | } | ||
14 | |||
15 | public Dispatcher BADispatcher { get; private set; } | ||
16 | |||
17 | protected override void Run() | ||
18 | { | ||
19 | this.BADispatcher = Dispatcher.CurrentDispatcher; | ||
20 | var window = new MainWindow(); | ||
21 | window.Closed += (s, e) => this.BADispatcher.InvokeShutdown(); | ||
22 | //window.Show(); | ||
23 | //Dispatcher.Run(); | ||
24 | //this.engine.Quit(0); | ||
25 | } | ||
26 | |||
27 | protected override void OnStartup(StartupEventArgs args) | ||
28 | { | ||
29 | base.OnStartup(args); | ||
30 | |||
31 | this.engine.Log(LogLevel.Standard, nameof(WPFCoreBA)); | ||
32 | } | ||
33 | |||
34 | protected override void OnShutdown(ShutdownEventArgs args) | ||
35 | { | ||
36 | base.OnShutdown(args); | ||
37 | |||
38 | var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); | ||
39 | this.engine.Log(LogLevel.Standard, message); | ||
40 | } | ||
41 | } | ||
42 | } | ||
diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBAFactory.cs b/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBAFactory.cs new file mode 100644 index 00000000..a3ccdf9f --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBAFactory.cs | |||
@@ -0,0 +1,22 @@ | |||
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 | [assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Example.WPFCoreMBA.WPFCoreBAFactory))] | ||
4 | namespace Example.WPFCoreMBA | ||
5 | { | ||
6 | using WixToolset.Mba.Core; | ||
7 | |||
8 | public class WPFCoreBAFactory : BaseBootstrapperApplicationFactory | ||
9 | { | ||
10 | private static int loadCount = 0; | ||
11 | |||
12 | protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) | ||
13 | { | ||
14 | if (loadCount > 0) | ||
15 | { | ||
16 | engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)"); | ||
17 | } | ||
18 | ++loadCount; | ||
19 | return new WPFCoreBA(engine); | ||
20 | } | ||
21 | } | ||
22 | } | ||
diff --git a/src/ext/Bal/test/examples/Wix.Build.props b/src/ext/Bal/test/examples/Wix.Build.props new file mode 100644 index 00000000..aad94bb6 --- /dev/null +++ b/src/ext/Bal/test/examples/Wix.Build.props | |||
@@ -0,0 +1,10 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | <Project> | ||
4 | <PropertyGroup> | ||
5 | <OutputType>Bundle</OutputType> | ||
6 | <TargetExt>.exe</TargetExt> | ||
7 | <HarvestDirectoryAdditionalOptions>-generate payloadgroup</HarvestDirectoryAdditionalOptions> | ||
8 | <OutputPath>$(OutputPath)examples\</OutputPath> | ||
9 | </PropertyGroup> | ||
10 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/Wix.Build.targets b/src/ext/Bal/test/examples/Wix.Build.targets new file mode 100644 index 00000000..7e6fe9f2 --- /dev/null +++ b/src/ext/Bal/test/examples/Wix.Build.targets | |||
@@ -0,0 +1,8 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | <Project> | ||
4 | <ItemGroup> | ||
5 | <BindInputPaths Include="$(OutputPath)" /> | ||
6 | <WixExtension Include="$(OutputPath)..\netstandard2.0\WixToolset.Bal.wixext.dll" /> | ||
7 | </ItemGroup> | ||
8 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/examples.proj b/src/ext/Bal/test/examples/examples.proj new file mode 100644 index 00000000..08cb7511 --- /dev/null +++ b/src/ext/Bal/test/examples/examples.proj | |||
@@ -0,0 +1,50 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- 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. --> | ||
3 | |||
4 | |||
5 | <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
6 | <Import Project="..\..\Directory.Build.props" /> | ||
7 | |||
8 | <PropertyGroup> | ||
9 | <EarliestCoreMBAProjectPath>EarliestCoreMBA\Example.EarliestCoreMBA.csproj</EarliestCoreMBAProjectPath> | ||
10 | <FullFramework2MBAProjectPath>FullFramework2MBA\Example.FullFramework2MBA.csproj</FullFramework2MBAProjectPath> | ||
11 | <FullFramework4MBAProjectPath>FullFramework4MBA\Example.FullFramework4MBA.csproj</FullFramework4MBAProjectPath> | ||
12 | <LatestCoreMBAProjectPath>LatestCoreMBA\Example.LatestCoreMBA.csproj</LatestCoreMBAProjectPath> | ||
13 | <WPFCoreMBAProjectPath>WPFCoreMBA\Example.WPFCoreMBA.csproj</WPFCoreMBAProjectPath> | ||
14 | <MBAPublishPath>$(OutputPath)examples\publish\</MBAPublishPath> | ||
15 | </PropertyGroup> | ||
16 | |||
17 | <ItemGroup> | ||
18 | <CoreMBAProject Include="$(EarliestCoreMBAProjectPath)"> | ||
19 | <PublishPath>$(MBAPublishPath)Example.EarliestCoreMBA</PublishPath> | ||
20 | </CoreMBAProject> | ||
21 | <CoreMBAProject Include="$(LatestCoreMBAProjectPath)"> | ||
22 | <PublishPath>$(MBAPublishPath)Example.LatestCoreMBA</PublishPath> | ||
23 | </CoreMBAProject> | ||
24 | <CoreMBAProject Include="$(WPFCoreMBAProjectPath)"> | ||
25 | <PublishPath>$(MBAPublishPath)Example.WPFCoreMBA</PublishPath> | ||
26 | <SkipSCD>true</SkipSCD> | ||
27 | <SkipTrimmedSCD>true</SkipTrimmedSCD> | ||
28 | </CoreMBAProject> | ||
29 | |||
30 | <FullMBAProject Include="$(FullFramework2MBAProjectPath)" /> | ||
31 | <FullMBAProject Include="$(FullFramework4MBAProjectPath)" /> | ||
32 | |||
33 | <ExampleBundleProject Include="**\*.wixproj" /> | ||
34 | </ItemGroup> | ||
35 | |||
36 | <Target Name="PublishCoreExamples"> | ||
37 | <Exec Command='dotnet publish -o "%(CoreMBAProject.PublishPath)\fdd" -r win-x86 -c $(Configuration) --self-contained false "%(CoreMBAProject.Identity)"' | ||
38 | Condition="'%(CoreMBAProject.SkipFDD)'==''" /> | ||
39 | <Exec Command='dotnet publish -o "%(CoreMBAProject.PublishPath)\scd" -r win-x86 -c $(Configuration) --self-contained true "%(CoreMBAProject.Identity)"' | ||
40 | Condition="'%(CoreMBAProject.SkipSCD)'==''" /> | ||
41 | <Exec Command='dotnet publish -o "%(CoreMBAProject.PublishPath)\trimmedscd" -r win-x86 -c $(Configuration) --self-contained true -p:PublishTrimmed=true "%(CoreMBAProject.Identity)"' | ||
42 | Condition="'%(CoreMBAProject.SkipTrimmedSCD)'==''" /> | ||
43 | </Target> | ||
44 | |||
45 | <Target Name="Build" DependsOnTargets="PublishCoreExamples"> | ||
46 | <MSBuild Projects="%(ExampleBundleProject.Identity)" /> | ||
47 | </Target> | ||
48 | |||
49 | <Import Project="..\..\Directory.Build.targets" /> | ||
50 | </Project> \ No newline at end of file | ||