@joebigelow / wix / commits / 4a176b75

Update the MbaHost test project to use an external exe to load the BA, which allows loading a different .NET than the one running the tests. This also allows writing the tests in C# instead of C++/CLI.

Sean Hall committed Dec 22, 2019 at 13:51 UTC 4a176b759c47fa1970fcfd0d9e25c294bda82ef4
33 files changed +756 -372
Bal.wixext.sln
+81 -10
@@ -13,78 +13,149 @@ Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "bal", "src\wixlib\bal.wixpr
13 EndProject
14 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Bal.wixext", "src\wixext\WixToolset.Bal.wixext.csproj", "{BF720A63-9D7B-456E-B60C-8122852D9FED}"
15 EndProject
16 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WixToolsetTest.MbaHost", "src\test\WixToolsetTest.MbaHost\WixToolsetTest.MbaHost.vcxproj", "{8C131CB9-7B1C-4B06-A328-E69CE9EDC763}"
17 -EndProject
16 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WixToolset.Mba.Host", "src\WixToolset.Mba.Host\WixToolset.Mba.Host.csproj", "{F2BA1935-70FA-4156-B161-FD03850B4FAA}"
17 EndProject
18 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{C70E3534-A018-4D0A-A340-916C9777EEF7}"
19 +EndProject
20 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Example.FullFramework2MBA", "src\test\examples\FullFramework2MBA\Example.FullFramework2MBA.csproj", "{CC4236FC-226E-4232-AB50-24CBEC4D314D}"
21 +EndProject
22 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Example.TestEngine", "src\test\examples\TestEngine\Example.TestEngine.vcxproj", "{3D44B67D-A475-49BA-8310-E39F6C117CC9}"
23 +EndProject
24 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.ManagedHost", "src\test\WixToolsetTest.ManagedHost\WixToolsetTest.ManagedHost.csproj", "{FED9D707-E5C3-4867-87B0-FABDB5EB0823}"
25 +EndProject
26 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.FullFramework4MBA", "src\test\examples\FullFramework4MBA\Example.FullFramework4MBA.csproj", "{44297646-706D-4508-8E96-1B35B109694C}"
27 +EndProject
28 Global
29 GlobalSection(SolutionConfigurationPlatforms) = preSolution
30 Debug|Any CPU = Debug|Any CPU
31 + Debug|x64 = Debug|x64
32 Debug|x86 = Debug|x86
33 Release|Any CPU = Release|Any CPU
34 + Release|x64 = Release|x64
35 Release|x86 = Release|x86
36 EndGlobalSection
37 GlobalSection(ProjectConfigurationPlatforms) = postSolution
38 {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Debug|Any CPU.ActiveCfg = Debug|Win32
39 {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Debug|Any CPU.Build.0 = Debug|Win32
40 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Debug|x64.ActiveCfg = Debug|Win32
41 {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Debug|x86.ActiveCfg = Debug|Win32
42 {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Debug|x86.Build.0 = Debug|Win32
43 {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Release|Any CPU.ActiveCfg = Release|Win32
44 {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Release|Any CPU.Build.0 = Release|Win32
45 + {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Release|x64.ActiveCfg = Release|Win32
46 {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Release|x86.ActiveCfg = Release|Win32
47 {EB0A7D51-2133-4EE7-B6CA-87DBEAC67E02}.Release|x86.Build.0 = Release|Win32
48 {12C87C77-3547-44F8-8134-29BC915CB19D}.Debug|Any CPU.ActiveCfg = Debug|Win32
49 {12C87C77-3547-44F8-8134-29BC915CB19D}.Debug|Any CPU.Build.0 = Debug|Win32
50 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Debug|x64.ActiveCfg = Debug|Win32
51 {12C87C77-3547-44F8-8134-29BC915CB19D}.Debug|x86.ActiveCfg = Debug|Win32
52 {12C87C77-3547-44F8-8134-29BC915CB19D}.Debug|x86.Build.0 = Debug|Win32
53 {12C87C77-3547-44F8-8134-29BC915CB19D}.Release|Any CPU.ActiveCfg = Release|Win32
54 {12C87C77-3547-44F8-8134-29BC915CB19D}.Release|Any CPU.Build.0 = Release|Win32
55 + {12C87C77-3547-44F8-8134-29BC915CB19D}.Release|x64.ActiveCfg = Release|Win32
56 {12C87C77-3547-44F8-8134-29BC915CB19D}.Release|x86.ActiveCfg = Release|Win32
57 {12C87C77-3547-44F8-8134-29BC915CB19D}.Release|x86.Build.0 = Release|Win32
58 {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Debug|Any CPU.ActiveCfg = Debug|Win32
59 {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Debug|Any CPU.Build.0 = Debug|Win32
60 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Debug|x64.ActiveCfg = Debug|Win32
61 {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Debug|x86.ActiveCfg = Debug|Win32
62 {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Debug|x86.Build.0 = Debug|Win32
63 {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Release|Any CPU.ActiveCfg = Release|Win32
64 {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Release|Any CPU.Build.0 = Release|Win32
65 + {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Release|x64.ActiveCfg = Release|Win32
66 {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Release|x86.ActiveCfg = Release|Win32
67 {41085A22-E6AA-4E8B-AB1B-DDEE0DC89DFA}.Release|x86.Build.0 = Release|Win32
68 {3444D952-F21C-496F-AB6B-56435BFD0787}.Debug|Any CPU.ActiveCfg = Debug|x86
69 {3444D952-F21C-496F-AB6B-56435BFD0787}.Debug|Any CPU.Build.0 = Debug|x86
70 + {3444D952-F21C-496F-AB6B-56435BFD0787}.Debug|x64.ActiveCfg = Debug|x86
71 {3444D952-F21C-496F-AB6B-56435BFD0787}.Debug|x86.ActiveCfg = Debug|x86
72 {3444D952-F21C-496F-AB6B-56435BFD0787}.Debug|x86.Build.0 = Debug|x86
73 {3444D952-F21C-496F-AB6B-56435BFD0787}.Release|Any CPU.ActiveCfg = Release|x86
74 {3444D952-F21C-496F-AB6B-56435BFD0787}.Release|Any CPU.Build.0 = Release|x86
75 + {3444D952-F21C-496F-AB6B-56435BFD0787}.Release|x64.ActiveCfg = Release|x86
76 {3444D952-F21C-496F-AB6B-56435BFD0787}.Release|x86.ActiveCfg = Release|x86
77 {3444D952-F21C-496F-AB6B-56435BFD0787}.Release|x86.Build.0 = Release|x86
78 {BF720A63-9D7B-456E-B60C-8122852D9FED}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
79 {BF720A63-9D7B-456E-B60C-8122852D9FED}.Debug|Any CPU.Build.0 = Debug|Any CPU
80 + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Debug|x64.ActiveCfg = Debug|Any CPU
81 + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Debug|x64.Build.0 = Debug|Any CPU
82 {BF720A63-9D7B-456E-B60C-8122852D9FED}.Debug|x86.ActiveCfg = Debug|Any CPU
83 {BF720A63-9D7B-456E-B60C-8122852D9FED}.Debug|x86.Build.0 = Debug|Any CPU
84 {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|Any CPU.ActiveCfg = Release|Any CPU
85 {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|Any CPU.Build.0 = Release|Any CPU
86 + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x64.ActiveCfg = Release|Any CPU
87 + {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x64.Build.0 = Release|Any CPU
88 {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x86.ActiveCfg = Release|Any CPU
89 {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x86.Build.0 = Release|Any CPU
68 - {8C131CB9-7B1C-4B06-A328-E69CE9EDC763}.Debug|Any CPU.ActiveCfg = Debug|Win32
69 - {8C131CB9-7B1C-4B06-A328-E69CE9EDC763}.Debug|Any CPU.Build.0 = Debug|Win32
70 - {8C131CB9-7B1C-4B06-A328-E69CE9EDC763}.Debug|x86.ActiveCfg = Debug|Win32
71 - {8C131CB9-7B1C-4B06-A328-E69CE9EDC763}.Debug|x86.Build.0 = Debug|Win32
72 - {8C131CB9-7B1C-4B06-A328-E69CE9EDC763}.Release|Any CPU.ActiveCfg = Release|Win32
73 - {8C131CB9-7B1C-4B06-A328-E69CE9EDC763}.Release|Any CPU.Build.0 = Release|Win32
74 - {8C131CB9-7B1C-4B06-A328-E69CE9EDC763}.Release|x86.ActiveCfg = Release|Win32
75 - {8C131CB9-7B1C-4B06-A328-E69CE9EDC763}.Release|x86.Build.0 = Release|Win32
90 {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
91 {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
92 + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|x64.ActiveCfg = Debug|Any CPU
93 + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|x64.Build.0 = Debug|Any CPU
94 {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|x86.ActiveCfg = Debug|Any CPU
95 {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|x86.Build.0 = Debug|Any CPU
96 {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Release|Any CPU.ActiveCfg = Release|Any CPU
97 {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Release|Any CPU.Build.0 = Release|Any CPU
98 + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Release|x64.ActiveCfg = Release|Any CPU
99 + {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Release|x64.Build.0 = Release|Any CPU
100 {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Release|x86.ActiveCfg = Release|Any CPU
101 {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Release|x86.Build.0 = Release|Any CPU
102 + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
103 + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Debug|Any CPU.Build.0 = Debug|Any CPU
104 + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Debug|x64.ActiveCfg = Debug|Any CPU
105 + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Debug|x64.Build.0 = Debug|Any CPU
106 + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Debug|x86.ActiveCfg = Debug|Any CPU
107 + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Debug|x86.Build.0 = Debug|Any CPU
108 + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Release|Any CPU.ActiveCfg = Release|Any CPU
109 + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Release|Any CPU.Build.0 = Release|Any CPU
110 + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Release|x64.ActiveCfg = Release|Any CPU
111 + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Release|x64.Build.0 = Release|Any CPU
112 + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Release|x86.ActiveCfg = Release|Any CPU
113 + {CC4236FC-226E-4232-AB50-24CBEC4D314D}.Release|x86.Build.0 = Release|Any CPU
114 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Debug|Any CPU.ActiveCfg = Debug|Win32
115 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Debug|Any CPU.Build.0 = Debug|Win32
116 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Debug|x64.ActiveCfg = Debug|x64
117 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Debug|x64.Build.0 = Debug|x64
118 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Debug|x86.ActiveCfg = Debug|Win32
119 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Debug|x86.Build.0 = Debug|Win32
120 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|Any CPU.ActiveCfg = Release|Win32
121 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|Any CPU.Build.0 = Release|Win32
122 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|x64.ActiveCfg = Release|x64
123 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|x64.Build.0 = Release|x64
124 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|x86.ActiveCfg = Release|Win32
125 + {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|x86.Build.0 = Release|Win32
126 + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
127 + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|Any CPU.Build.0 = Debug|Any CPU
128 + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|x64.ActiveCfg = Debug|Any CPU
129 + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|x64.Build.0 = Debug|Any CPU
130 + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|x86.ActiveCfg = Debug|Any CPU
131 + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|x86.Build.0 = Debug|Any CPU
132 + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Release|Any CPU.ActiveCfg = Release|Any CPU
133 + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Release|Any CPU.Build.0 = Release|Any CPU
134 + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Release|x64.ActiveCfg = Release|Any CPU
135 + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Release|x64.Build.0 = Release|Any CPU
136 + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Release|x86.ActiveCfg = Release|Any CPU
137 + {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Release|x86.Build.0 = Release|Any CPU
138 + {44297646-706D-4508-8E96-1B35B109694C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
139 + {44297646-706D-4508-8E96-1B35B109694C}.Debug|Any CPU.Build.0 = Debug|Any CPU
140 + {44297646-706D-4508-8E96-1B35B109694C}.Debug|x64.ActiveCfg = Debug|Any CPU
141 + {44297646-706D-4508-8E96-1B35B109694C}.Debug|x64.Build.0 = Debug|Any CPU
142 + {44297646-706D-4508-8E96-1B35B109694C}.Debug|x86.ActiveCfg = Debug|Any CPU
143 + {44297646-706D-4508-8E96-1B35B109694C}.Debug|x86.Build.0 = Debug|Any CPU
144 + {44297646-706D-4508-8E96-1B35B109694C}.Release|Any CPU.ActiveCfg = Release|Any CPU
145 + {44297646-706D-4508-8E96-1B35B109694C}.Release|Any CPU.Build.0 = Release|Any CPU
146 + {44297646-706D-4508-8E96-1B35B109694C}.Release|x64.ActiveCfg = Release|Any CPU
147 + {44297646-706D-4508-8E96-1B35B109694C}.Release|x64.Build.0 = Release|Any CPU
148 + {44297646-706D-4508-8E96-1B35B109694C}.Release|x86.ActiveCfg = Release|Any CPU
149 + {44297646-706D-4508-8E96-1B35B109694C}.Release|x86.Build.0 = Release|Any CPU
150 EndGlobalSection
151 GlobalSection(SolutionProperties) = preSolution
152 HideSolutionNode = FALSE
153 EndGlobalSection
154 + GlobalSection(NestedProjects) = preSolution
155 + {CC4236FC-226E-4232-AB50-24CBEC4D314D} = {C70E3534-A018-4D0A-A340-916C9777EEF7}
156 + {3D44B67D-A475-49BA-8310-E39F6C117CC9} = {C70E3534-A018-4D0A-A340-916C9777EEF7}
157 + {44297646-706D-4508-8E96-1B35B109694C} = {C70E3534-A018-4D0A-A340-916C9777EEF7}
158 + EndGlobalSection
159 GlobalSection(ExtensibilityGlobals) = postSolution
160 SolutionGuid = {74046961-48BF-467A-A6C2-F886C75CE0BE}
161 EndGlobalSection
src/Custom.Build.props new
+9
@@ -0,0 +1,9 @@
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 xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5 + <PropertyGroup>
6 + <OutputPath Condition="$(ProjectName.StartsWith('Example.')) And '$(MSBuildProjectExtension)'=='.csproj' ">$(OutputPath)examples\$(ProjectName)\</OutputPath>
7 + <OutDir Condition="$(ProjectName.StartsWith('Example.')) And '$(MSBuildProjectExtension)'=='.vcxproj' ">$(OutDir)examples\$(ProjectName)\</OutDir>
8 + </PropertyGroup>
9 +</Project>
src/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs new
+40
@@ -0,0 +1,40 @@
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 WixBuildTools.TestSupport;
6 + using Xunit;
7 +
8 + public class MbaHostFixture
9 + {
10 + [Fact]
11 + public void CanLoadFullFramework2MBA()
12 + {
13 + var testEngine = new TestEngine();
14 + var baFile = TestData.Get(@"..\examples\Example.FullFramework2MBA\mbahost.dll");
15 +
16 + var result = testEngine.RunShutdownEngine(baFile);
17 + Assert.Equal(0, result.ExitCode);
18 +
19 + var logMessages = result.Output;
20 + Assert.Equal(2, logMessages.Count);
21 + Assert.Equal("Loading managed bootstrapper application.", logMessages[0]);
22 + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[1]);
23 + }
24 +
25 + [Fact]
26 + public void CanLoadFullFramework4MBA()
27 + {
28 + var testEngine = new TestEngine();
29 + var baFile = TestData.Get(@"..\examples\Example.FullFramework4MBA\net48\mbahost.dll");
30 +
31 + var result = testEngine.RunShutdownEngine(baFile);
32 + Assert.Equal(0, result.ExitCode);
33 +
34 + var logMessages = result.Output;
35 + Assert.Equal(2, logMessages.Count);
36 + Assert.Equal("Loading managed bootstrapper application.", logMessages[0]);
37 + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[1]);
38 + }
39 + }
40 +}
src/test/WixToolsetTest.ManagedHost/TestEngine.cs new
+53
@@ -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 +namespace WixToolsetTest.ManagedHost
4 +{
5 + using System.Collections.Generic;
6 + using System.Diagnostics;
7 + using WixBuildTools.TestSupport;
8 +
9 + public class TestEngine
10 + {
11 + private static readonly string TestEngineFile = TestData.Get(@"..\Win32\examples\Example.TestEngine\Example.TestEngine.exe");
12 +
13 + public TestEngineResult RunShutdownEngine(string baFile)
14 + {
15 + var args = new string[] { '"' + baFile + '"' };
16 + return RunProcessCaptureOutput(TestEngineFile, args);
17 + }
18 +
19 + private static TestEngineResult RunProcessCaptureOutput(string executablePath, string[] arguments = null, string workingFolder = null)
20 + {
21 + var startInfo = new ProcessStartInfo(executablePath)
22 + {
23 + Arguments = string.Join(' ', arguments),
24 + CreateNoWindow = true,
25 + RedirectStandardError = true,
26 + RedirectStandardOutput = true,
27 + UseShellExecute = false,
28 + WorkingDirectory = workingFolder,
29 + };
30 +
31 + var exitCode = 0;
32 + var output = new List<string>();
33 +
34 + using (var process = Process.Start(startInfo))
35 + {
36 + process.OutputDataReceived += (s, e) => { if (e.Data != null) { output.Add(e.Data); } };
37 + process.ErrorDataReceived += (s, e) => { if (e.Data != null) { output.Add(e.Data); } };
38 +
39 + process.BeginErrorReadLine();
40 + process.BeginOutputReadLine();
41 +
42 + process.WaitForExit();
43 + exitCode = process.ExitCode;
44 + }
45 +
46 + return new TestEngineResult
47 + {
48 + ExitCode = exitCode,
49 + Output = output,
50 + };
51 + }
52 + }
53 +}
src/test/WixToolsetTest.ManagedHost/TestEngineResult.cs new
+12
@@ -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 +}
src/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj new
+31
@@ -0,0 +1,31 @@
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>netcoreapp2.1</TargetFramework>
7 + <IsPackable>false</IsPackable>
8 + </PropertyGroup>
9 +
10 + <PropertyGroup>
11 + <NoWarn>NU1701</NoWarn>
12 + </PropertyGroup>
13 +
14 + <ItemGroup>
15 + </ItemGroup>
16 +
17 + <ItemGroup>
18 + <ProjectReference Include="..\examples\FullFramework2MBA\Example.FullFramework2MBA.csproj" />
19 + <ProjectReference Include="..\examples\TestEngine\Example.TestEngine.vcxproj" />
20 + </ItemGroup>
21 +
22 + <ItemGroup>
23 + <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.*" />
24 + </ItemGroup>
25 +
26 + <ItemGroup>
27 + <PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.5.0" />
28 + <PackageReference Include="xunit" Version="2.4.1" />
29 + <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" />
30 + </ItemGroup>
31 +</Project>
src/test/WixToolsetTest.MbaHost/EngineForTest.cpp deleted
-45
@@ -1,45 +0,0 @@
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 -static HRESULT BAEngineLog(
6 - __in BOOTSTRAPPER_ENGINE_CONTEXT* pContext,
7 - __in BAENGINE_LOG_ARGS* pArgs,
8 - __in BAENGINE_LOG_RESULTS* /*pResults*/
9 -)
10 -{
11 - HRESULT hr = S_OK;
12 -
13 - pContext->pfnLog(pArgs->wzMessage);
14 -
15 - return hr;
16 -}
17 -
18 -HRESULT WINAPI EngineForTestProc(
19 - __in BOOTSTRAPPER_ENGINE_MESSAGE message,
20 - __in const LPVOID pvArgs,
21 - __inout LPVOID pvResults,
22 - __in_opt LPVOID pvContext
23 -)
24 -{
25 - HRESULT hr = S_OK;
26 - BOOTSTRAPPER_ENGINE_CONTEXT* pContext = reinterpret_cast<BOOTSTRAPPER_ENGINE_CONTEXT*>(pvContext);
27 -
28 - if (!pContext || !pvArgs || !pvResults)
29 - {
30 - ExitFunction1(hr = E_INVALIDARG);
31 - }
32 -
33 - switch (message)
34 - {
35 - case BOOTSTRAPPER_ENGINE_MESSAGE_LOG:
36 - hr = BAEngineLog(pContext, reinterpret_cast<BAENGINE_LOG_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_LOG_RESULTS*>(pvResults));
37 - break;
38 - default:
39 - hr = E_NOTIMPL;
40 - break;
41 - }
42 -
43 -LExit:
44 - return hr;
45 -}
\ No newline at end of file
src/test/WixToolsetTest.MbaHost/EngineForTest.h deleted
-63
@@ -1,63 +0,0 @@
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 -HRESULT WINAPI EngineForTestProc(
5 - __in BOOTSTRAPPER_ENGINE_MESSAGE message,
6 - __in const LPVOID pvArgs,
7 - __inout LPVOID pvResults,
8 - __in_opt LPVOID pvContext
9 -);
10 -
11 -typedef void(WINAPI *PFN_TEST_LOG_PROC)(
12 - __in LPCWSTR sczMessage
13 - );
14 -
15 -struct BOOTSTRAPPER_ENGINE_CONTEXT
16 -{
17 - PFN_TEST_LOG_PROC pfnLog;
18 -};
19 -
20 -namespace WixToolsetTest
21 -{
22 -namespace MbaHost
23 -{
24 -namespace Native
25 -{
26 - using namespace System;
27 - using namespace System::Collections::Generic;
28 - using namespace System::Runtime::InteropServices;
29 -
30 - public ref class EngineForTest
31 - {
32 - private:
33 - delegate void LogDelegate(LPCWSTR);
34 - LogDelegate^ _logDelegate;
35 - List<String^>^ _messages;
36 -
37 - void Log(LPCWSTR sczMessage)
38 - {
39 - String^ message = gcnew String(sczMessage);
40 - System::Diagnostics::Debug::WriteLine(message);
41 - _messages->Add(message);
42 - }
43 - public:
44 - EngineForTest()
45 - {
46 - _logDelegate = gcnew LogDelegate(this, &EngineForTest::Log);
47 - _messages = gcnew List<String^>();
48 - }
49 -
50 - List<String^>^ GetLogMessages()
51 - {
52 - return _messages;
53 - }
54 -
55 - PFN_TEST_LOG_PROC GetTestLogProc()
56 - {
57 - IntPtr functionPointer = Marshal::GetFunctionPointerForDelegate(_logDelegate);
58 - return static_cast<PFN_TEST_LOG_PROC>(functionPointer.ToPointer());
59 - }
60 - };
61 -}
62 -}
63 -}
\ No newline at end of file
src/test/WixToolsetTest.MbaHost/MbaHostFixture.cpp deleted
-70
@@ -1,70 +0,0 @@
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 -namespace WixToolsetTest
6 -{
7 -namespace MbaHost
8 -{
9 -namespace Native
10 -{
11 - using namespace System;
12 - using namespace Xunit;
13 -
14 - public ref class MbaHostFixture
15 - {
16 - public:
17 - [Fact]
18 - void CanLoadManagedBootstrapperApplication()
19 - {
20 - HMODULE hBAModule = NULL;
21 - PFN_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = NULL;
22 - HRESULT hr = S_OK;
23 -
24 - EngineForTest^ engine = gcnew EngineForTest();
25 - BOOTSTRAPPER_ENGINE_CONTEXT engineContext = { };
26 - engineContext.pfnLog = engine->GetTestLogProc();
27 -
28 - LogInitialize(::GetModuleHandleW(NULL));
29 -
30 - hr = LogOpen(NULL, L"MbaHostUnitTest", NULL, L"txt", FALSE, FALSE, NULL);
31 - Assert::Equal(S_OK, hr);
32 -
33 - BOOTSTRAPPER_COMMAND command = { };
34 - BOOTSTRAPPER_CREATE_ARGS args = { };
35 - BOOTSTRAPPER_CREATE_RESULTS results = { };
36 -
37 - args.cbSize = sizeof(BOOTSTRAPPER_CREATE_ARGS);
38 - args.pCommand = &command;
39 - args.pfnBootstrapperEngineProc = EngineForTestProc;
40 - args.pvBootstrapperEngineProcContext = &engineContext;
41 - args.qwEngineAPIVersion = MAKEQWORDVERSION(0, 0, 0, 1);
42 -
43 - results.cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS);
44 -
45 - hBAModule = ::LoadLibraryExW(L"mbahost.dll", NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
46 - Assert::NotEqual(NULL, (int)hBAModule);
47 -
48 - pfnCreate = (PFN_BOOTSTRAPPER_APPLICATION_CREATE)::GetProcAddress(hBAModule, "BootstrapperApplicationCreate");
49 - Assert::NotEqual(NULL, (int)pfnCreate);
50 -
51 - hr = pfnCreate(&args, &results);
52 - Assert::Equal(S_OK, hr);
53 -
54 - BA_ONSHUTDOWN_ARGS shutdownArgs = { };
55 - BA_ONSHUTDOWN_RESULTS shutdownResults = { };
56 - shutdownArgs.cbSize = sizeof(BA_ONSHUTDOWN_ARGS);
57 - shutdownResults.action = BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER;
58 - shutdownResults.cbSize = sizeof(BA_ONSHUTDOWN_RESULTS);
59 - hr = results.pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, &shutdownArgs, &shutdownResults, results.pvBootstrapperApplicationProcContext);
60 - Assert::Equal(S_OK, hr);
61 -
62 - List<String^>^ logMessages = engine->GetLogMessages();
63 - Assert::Equal(2, logMessages->Count);
64 - Assert::Equal("Loading managed bootstrapper application.", logMessages[0]);
65 - Assert::Equal("Shutdown,ReloadBootstrapper,0", logMessages[1]);
66 - }
67 - };
68 -}
69 -}
70 -}
src/test/WixToolsetTest.MbaHost/TestManagedBootstrapperApplication.h deleted
-34
@@ -1,34 +0,0 @@
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 -namespace WixToolsetTest
5 -{
6 -namespace MbaHost
7 -{
8 -namespace Native
9 -{
10 - using namespace System;
11 - using namespace WixToolset::Mba::Core;
12 -
13 - public ref class TestManagedBootstrapperApplication : BootstrapperApplication
14 - {
15 - public:
16 - TestManagedBootstrapperApplication(WixToolset::Mba::Core::IEngine^ engine)
17 - : BootstrapperApplication(engine)
18 - {
19 -
20 - }
21 -
22 - virtual void Run() override
23 - {
24 - }
25 -
26 - virtual void OnShutdown(ShutdownEventArgs^ e) override
27 - {
28 - String^ message = "Shutdown," + e->Action.ToString() + "," + e->HResult.ToString();
29 - this->engine->Log(LogLevel::Standard, message);
30 - }
31 - };
32 -}
33 -}
34 -}
\ No newline at end of file
src/test/WixToolsetTest.MbaHost/TestManagedBootstrapperApplicationFactory.h deleted
-25
@@ -1,25 +0,0 @@
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 -namespace WixToolsetTest
5 -{
6 -namespace MbaHost
7 -{
8 -namespace Native
9 -{
10 - using namespace System;
11 - using namespace WixToolset::Mba::Core;
12 -
13 - public ref class TestManagedBootstrapperApplicationFactory : public BaseBootstrapperApplicationFactory
14 - {
15 - protected:
16 - virtual IBootstrapperApplication^ Create(IEngine^ engine, IBootstrapperCommand^ /*command*/) override
17 - {
18 - return gcnew TestManagedBootstrapperApplication(engine);
19 - }
20 - };
21 -
22 - [assembly:BootstrapperApplicationFactory(TestManagedBootstrapperApplicationFactory::typeid)];
23 -}
24 -}
25 -}
\ No newline at end of file
src/test/WixToolsetTest.MbaHost/WixToolsetTest.MbaHost.vcxproj deleted
-95
@@ -1,95 +0,0 @@
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.12\build\WixToolset.BalUtil.props" Condition="Exists('..\..\..\packages\WixToolset.BalUtil.4.0.12\build\WixToolset.BalUtil.props')" />
5 - <Import Project="..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.10\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.10\build\WixToolset.BootstrapperCore.Native.props')" />
6 - <Import Project="..\..\..\packages\xunit.core.2.4.0\build\xunit.core.props" Condition="Exists('..\..\..\packages\xunit.core.2.4.0\build\xunit.core.props')" />
7 - <Import Project="..\..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props" Condition="Exists('..\..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" />
8 - <ItemGroup Label="ProjectConfigurations">
9 - <ProjectConfiguration Include="Debug|Win32">
10 - <Configuration>Debug</Configuration>
11 - <Platform>Win32</Platform>
12 - </ProjectConfiguration>
13 - <ProjectConfiguration Include="Release|Win32">
14 - <Configuration>Release</Configuration>
15 - <Platform>Win32</Platform>
16 - </ProjectConfiguration>
17 - </ItemGroup>
18 - <PropertyGroup Label="Globals">
19 - <ProjectTypes>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}</ProjectTypes>
20 - <ProjectGuid>{8C131CB9-7B1C-4B06-A328-E69CE9EDC763}</ProjectGuid>
21 - <RootNamespace>WixToolsetTest.MbaHost</RootNamespace>
22 - <Keyword>ManagedCProj</Keyword>
23 - <ConfigurationType>DynamicLibrary</ConfigurationType>
24 - <PlatformToolset>v141</PlatformToolset>
25 - <CharacterSet>Unicode</CharacterSet>
26 - <CLRSupport>true</CLRSupport>
27 - <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
28 - </PropertyGroup>
29 - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
30 - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
31 - <PropertyGroup>
32 - <ProjectAdditionalLinkLibraries></ProjectAdditionalLinkLibraries>
33 - </PropertyGroup>
34 - <ItemGroup>
35 - <ClCompile Include="EngineForTest.cpp" />
36 - <ClCompile Include="MbaHostFixture.cpp" />
37 - <ClCompile Include="precomp.cpp">
38 - <PrecompiledHeader>Create</PrecompiledHeader>
39 - </ClCompile>
40 - </ItemGroup>
41 - <ItemGroup>
42 - <ClInclude Include="EngineForTest.h" />
43 - <ClInclude Include="precomp.h" />
44 - <ClInclude Include="TestManagedBootstrapperApplication.h" />
45 - <ClInclude Include="TestManagedBootstrapperApplicationFactory.h" />
46 - </ItemGroup>
47 -
48 - <ItemGroup>
49 - <None Include="packages.config" />
50 - <Content Include="BootstrapperApplicationData.xml" CopyToOutputDirectory="PreserveNewest" />
51 - <Content Include="WixToolset.Mba.Host.config" CopyToOutputDirectory="PreserveNewest" />
52 - <Content Include="..\..\..\packages\WixToolset.Mba.Core.4.0.12\build\native\x86\mbanative.dll" Condition="Exists('..\..\..\packages\WixToolset.Mba.Core.4.0.12\build\native\x86\mbanative.dll')" CopyToOutputDirectory="PreserveNewest">
53 - <Visible>False</Visible>
54 - </Content>
55 - </ItemGroup>
56 - <ItemGroup>
57 - <Reference Include="System" />
58 - <Reference Include="System.Core" />
59 - <Reference Include="xunit.abstractions">
60 - <HintPath>..\..\..\packages\xunit.abstractions.2.0.2\lib\net35\xunit.abstractions.dll</HintPath>
61 - </Reference>
62 - <Reference Include="xunit.assert">
63 - <HintPath>..\..\..\packages\xunit.assert.2.4.0\lib\netstandard2.0\xunit.assert.dll</HintPath>
64 - </Reference>
65 - <Reference Include="xunit.core">
66 - <HintPath>..\..\..\packages\xunit.extensibility.core.2.4.0\lib\net452\xunit.core.dll</HintPath>
67 - </Reference>
68 - <Reference Include="xunit.execution.desktop">
69 - <HintPath>..\..\..\packages\xunit.extensibility.execution.2.4.0\lib\net452\xunit.execution.desktop.dll</HintPath>
70 - </Reference>
71 - <Reference Include="WixToolset.Mba.Core">
72 - <HintPath>..\..\..\packages\WixToolset.Mba.Core.4.0.12\lib\net20\WixToolset.Mba.Core.dll</HintPath>
73 - </Reference>
74 - </ItemGroup>
75 - <ItemGroup>
76 - <ProjectReference Include="..\..\mbahost\mbahost.vcxproj">
77 - <Project>{12c87c77-3547-44f8-8134-29bc915cb19d}</Project>
78 - </ProjectReference>
79 - </ItemGroup>
80 - <ItemGroup>
81 - <Analyzer Include="..\packages\xunit.analyzers.0.10.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
82 - </ItemGroup>
83 - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
84 - <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
85 - <PropertyGroup>
86 - <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>
87 - </PropertyGroup>
88 - <Error Condition="!Exists('..\..\..\packages\WixToolset.BalUtil.4.0.12\build\WixToolset.BalUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixToolset.BalUtil.4.0.12\build\WixToolset.BalUtil.props'))" />
89 - <Error Condition="!Exists('..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.10\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.10\build\WixToolset.BootstrapperCore.Native.props'))" />
90 - <Error Condition="!Exists('..\..\..\packages\xunit.core.2.4.0\build\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\xunit.core.2.4.0\build\xunit.core.props'))" />
91 - <Error Condition="!Exists('..\..\..\packages\xunit.core.2.4.0\build\xunit.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\xunit.core.2.4.0\build\xunit.core.targets'))" />
92 - <Error Condition="!Exists('..\..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props'))" />
93 - </Target>
94 - <Import Project="..\..\..\packages\xunit.core.2.4.0\build\xunit.core.targets" Condition="Exists('..\..\..\packages\xunit.core.2.4.0\build\xunit.core.targets')" />
95 -</Project>
\ No newline at end of file
src/test/WixToolsetTest.MbaHost/packages.config deleted
-15
@@ -1,15 +0,0 @@
1 -<?xml version="1.0" encoding="utf-8"?>
2 -<packages>
3 - <package id="xunit" version="2.4.0" targetFramework="net461" />
4 - <package id="xunit.abstractions" version="2.0.2" targetFramework="net461" />
5 - <package id="xunit.analyzers" version="0.10.0" targetFramework="net461" />
6 - <package id="xunit.assert" version="2.4.0" targetFramework="net461" />
7 - <package id="xunit.core" version="2.4.0" targetFramework="net461" />
8 - <package id="xunit.extensibility.core" version="2.4.0" targetFramework="net461" />
9 - <package id="xunit.extensibility.execution" version="2.4.0" targetFramework="net461" />
10 - <package id="xunit.runner.visualstudio" version="2.4.0" targetFramework="net461" />
11 - <package id="WixToolset.BalUtil" version="4.0.12" targetFramework="native" />
12 - <package id="WixToolset.BootstrapperCore.Native" version="4.0.10" targetFramework="native" />
13 - <package id="WixToolset.DUtil" version="4.0.18" targetFramework="native" />
14 - <package id="WixToolset.Mba.Core" version="4.0.12" targetFramework="net461" />
15 -</packages>
\ No newline at end of file
src/test/examples/FullFramework2MBA/BootstrapperApplicationData.xml renamed
src/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj new
+77
@@ -0,0 +1,77 @@
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="..\..\..\..\packages\WixToolset.Mba.Core.4.0.12\build\net20\WixToolset.Mba.Core.props" Condition="Exists('..\..\..\..\packages\WixToolset.Mba.Core.4.0.12\build\net20\WixToolset.Mba.Core.props')" />
7 + <PropertyGroup>
8 + <ProjectGuid>{CC4236FC-226E-4232-AB50-24CBEC4D314D}</ProjectGuid>
9 + <AssemblyName>Example.FullFramework2MBA</AssemblyName>
10 + <OutputType>Library</OutputType>
11 + <RootNamespace>Example.FullFramework2MBA</RootNamespace>
12 + <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
13 + <CreateDocumentation>false</CreateDocumentation>
14 + </PropertyGroup>
15 + <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
16 + <DebugSymbols>true</DebugSymbols>
17 + <Optimize>false</Optimize>
18 + <DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants>
19 + </PropertyGroup>
20 + <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
21 + <DebugSymbols>true</DebugSymbols>
22 + <Optimize>true</Optimize>
23 + <DefineConstants>$(DefineConstants);TRACE</DefineConstants>
24 + </PropertyGroup>
25 + <ItemGroup>
26 + <Compile Include="FullFramework2BA.cs" />
27 + <Compile Include="FullFramework2BAFactory.cs" />
28 + <Compile Include="Properties\AssemblyInfo.cs" />
29 + </ItemGroup>
30 + <ItemGroup>
31 + <Content Include="BootstrapperApplicationData.xml" CopyToOutputDirectory="PreserveNewest" />
32 + <Content Include="WixToolset.Mba.Host.config" CopyToOutputDirectory="PreserveNewest" />
33 + </ItemGroup>
34 + <ItemGroup>
35 + <None Include="packages.config" />
36 + </ItemGroup>
37 + <ItemGroup>
38 + <Reference Include="System" />
39 + <Reference Include="System.Configuration" />
40 + <Reference Include="System.Data" />
41 + <Reference Include="System.Xml" />
42 + <Reference Include="WixToolset.Mba.Core">
43 + <HintPath>..\..\..\..\packages\WixToolset.Mba.Core.4.0.12\lib\net20\WixToolset.Mba.Core.dll</HintPath>
44 + </Reference>
45 + </ItemGroup>
46 + <ItemGroup>
47 + <ProjectReference Include="..\..\..\mbahost\mbahost.vcxproj">
48 + <Project>{12c87c77-3547-44f8-8134-29bc915cb19d}</Project>
49 + <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
50 + </ProjectReference>
51 + <ProjectReference Include="..\..\..\WixToolset.Mba.Host\WixToolset.Mba.Host.csproj">
52 + <Project>{F2BA1935-70FA-4156-B161-FD03850B4FAA}</Project>
53 + <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
54 + <OutputItemType>Content</OutputItemType>
55 + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
56 + </ProjectReference>
57 + </ItemGroup>
58 +
59 + <ItemGroup>
60 + <MbaHostDependency Include="$(BaseOutputPath)$(Configuration)\Win32\mbahost.dll" />
61 + </ItemGroup>
62 +
63 + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
64 +
65 + <Import Project="..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" />
66 + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
67 + <PropertyGroup>
68 + <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>
69 + </PropertyGroup>
70 + <Error Condition="!Exists('..\..\..\..\packages\WixToolset.Mba.Core.4.0.12\build\net20\WixToolset.Mba.Core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.Mba.Core.4.0.12\build\net20\WixToolset.Mba.Core.props'))" />
71 + <Error Condition="!Exists('..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets'))" />
72 + </Target>
73 +
74 + <Target Name="CopyMbaHostDependencies" AfterTargets="Build">
75 + <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(MbaHostDependency)" SkipUnchangedFiles="true" />
76 + </Target>
77 +</Project>
\ No newline at end of file
src/test/examples/FullFramework2MBA/FullFramework2BA.cs new
+27
@@ -0,0 +1,27 @@
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 OnShutdown(ShutdownEventArgs args)
20 + {
21 + base.OnShutdown(args);
22 +
23 + var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString();
24 + this.engine.Log(LogLevel.Standard, message);
25 + }
26 + }
27 +}
src/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs new
+14
@@ -0,0 +1,14 @@
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 FullFramework2BAFactory : BaseBootstrapperApplicationFactory
8 + {
9 + protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand)
10 + {
11 + return new FullFramework2BA(engine);
12 + }
13 + }
14 +}
src/test/examples/FullFramework2MBA/Properties/AssemblyInfo.cs new
+18
@@ -0,0 +1,18 @@
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;
4 +using System.Reflection;
5 +using System.Runtime.InteropServices;
6 +using WixToolset.Mba.Core;
7 +
8 +[assembly: AssemblyTitle("Example.FullFramework2MBA")]
9 +[assembly: AssemblyDescription("Example.FullFramework2MBA")]
10 +[assembly: AssemblyProduct("WiX Toolset")]
11 +[assembly: AssemblyCompany("WiX Toolset Team")]
12 +[assembly: AssemblyCopyright("Copyright (c) .NET Foundation and contributors. All rights reserved.")]
13 +
14 +// Types should not be visible to COM by default.
15 +[assembly: ComVisible(false)]
16 +[assembly: Guid("7A671EAF-FAE5-41A2-83DD-C35AB3779651")]
17 +
18 +[assembly: BootstrapperApplicationFactory(typeof(Example.FullFramework2MBA.FullFramework2BAFactory))]
src/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config renamed
+4 -10
@@ -8,19 +8,13 @@
8 <section name="host" type="WixToolset.Mba.Host.HostSection, WixToolset.Mba.Host" />
9 </sectionGroup>
10 </configSections>
11 - <startup useLegacyV2RuntimeActivationPolicy="true">
12 - <supportedRuntime version="v4.0" />
11 + <startup>
12 <supportedRuntime version="v2.0.50727" />
13 </startup>
14 <wix.bootstrapper>
16 - <!-- Example only. Use only if the startup/supportedRuntime above cannot discern supported frameworks. -->
17 - <!--
18 - <supportedFramework version="v4\Client" />
19 - <supportedFramework version="v3.5" />
20 - <supportedFramework version="v3.0" />
21 - -->
15
23 - <!-- Example only. Replace the host/@assemblyName attribute with assembly that implements IBootstrapperApplicationFactory. -->
24 - <host assemblyName="WixToolsetTest.MbaHost" />
16 + <host assemblyName="Example.FullFramework2MBA">
17 + <supportedFramework version="v3.5" />
18 + </host>
19 </wix.bootstrapper>
20 </configuration>
src/test/examples/FullFramework2MBA/packages.config new
+4
@@ -0,0 +1,4 @@
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<packages>
3 + <package id="WixToolset.Mba.Core" version="4.0.12" targetFramework="net461" />
4 +</packages>
\ No newline at end of file
src/test/examples/FullFramework4MBA/BootstrapperApplicationData.xml
Binary files /dev/null and b/src/test/examples/FullFramework4MBA/BootstrapperApplicationData.xml differ
src/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj new
+38
@@ -0,0 +1,38 @@
1 +<Project Sdk="Microsoft.NET.Sdk">
2 +
3 + <PropertyGroup>
4 + <TargetFramework>net48</TargetFramework>
5 + <Description>Full Framework v4 MBA</Description>
6 + </PropertyGroup>
7 +
8 + <ItemGroup>
9 + <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" />
10 + <PackageReference Include="WixToolset.Mba.Core" Version="4.0.*" PrivateAssets="All" />
11 + </ItemGroup>
12 +
13 + <ItemGroup>
14 + <Content Include="BootstrapperApplicationData.xml" CopyToOutputDirectory="PreserveNewest" />
15 + <Content Include="WixToolset.Mba.Host.config" CopyToOutputDirectory="PreserveNewest" />
16 + </ItemGroup>
17 +
18 + <ItemGroup>
19 + <ProjectReference Include="..\..\..\mbahost\mbahost.vcxproj">
20 + <Project>{12c87c77-3547-44f8-8134-29bc915cb19d}</Project>
21 + <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
22 + </ProjectReference>
23 + <ProjectReference Include="..\..\..\WixToolset.Mba.Host\WixToolset.Mba.Host.csproj">
24 + <Project>{F2BA1935-70FA-4156-B161-FD03850B4FAA}</Project>
25 + <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
26 + <OutputItemType>Content</OutputItemType>
27 + <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
28 + </ProjectReference>
29 + </ItemGroup>
30 +
31 + <ItemGroup>
32 + <MbaHostDependency Include="$(BaseOutputPath)$(Configuration)\Win32\mbahost.dll" />
33 + </ItemGroup>
34 +
35 + <Target Name="CopyMbaHostDependencies" AfterTargets="Build">
36 + <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(MbaHostDependency)" SkipUnchangedFiles="true" />
37 + </Target>
38 +</Project>
\ No newline at end of file
src/test/examples/FullFramework4MBA/FullFramework4BA.cs new
+27
@@ -0,0 +1,27 @@
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 OnShutdown(ShutdownEventArgs args)
20 + {
21 + base.OnShutdown(args);
22 +
23 + var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString();
24 + this.engine.Log(LogLevel.Standard, message);
25 + }
26 + }
27 +}
src/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs new
+15
@@ -0,0 +1,15 @@
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 + protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand)
11 + {
12 + return new FullFramework4BA(engine);
13 + }
14 + }
15 +}
src/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config new
+17
@@ -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>
src/test/examples/TestEngine/Example.TestEngine.vcxproj new
+70
@@ -0,0 +1,70 @@
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.12\build\WixToolset.BalUtil.props" Condition="Exists('..\..\..\..\packages\WixToolset.BalUtil.4.0.12\build\WixToolset.BalUtil.props')" />
5 + <Import Project="..\..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.10\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.10\build\WixToolset.BootstrapperCore.Native.props')" />
6 + <Import Project="..\..\..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props" Condition="Exists('..\..\..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" />
7 + <ItemGroup Label="ProjectConfigurations">
8 + <ProjectConfiguration Include="Debug|Win32">
9 + <Configuration>Debug</Configuration>
10 + <Platform>Win32</Platform>
11 + </ProjectConfiguration>
12 + <ProjectConfiguration Include="Release|Win32">
13 + <Configuration>Release</Configuration>
14 + <Platform>Win32</Platform>
15 + </ProjectConfiguration>
16 + <ProjectConfiguration Include="Debug|x64">
17 + <Configuration>Debug</Configuration>
18 + <Platform>x64</Platform>
19 + </ProjectConfiguration>
20 + <ProjectConfiguration Include="Release|x64">
21 + <Configuration>Release</Configuration>
22 + <Platform>x64</Platform>
23 + </ProjectConfiguration>
24 + </ItemGroup>
25 + <PropertyGroup Label="Globals">
26 + <ProjectGuid>{3D44B67D-A475-49BA-8310-E39F6C117CC9}</ProjectGuid>
27 + <ConfigurationType>Application</ConfigurationType>
28 + <ProjectSubSystem>Console</ProjectSubSystem>
29 + <TargetName>Example.TestEngine</TargetName>
30 + <PlatformToolset>v141</PlatformToolset>
31 + <CharacterSet>Unicode</CharacterSet>
32 + <WindowsTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion>
33 + </PropertyGroup>
34 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
35 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
36 + <ImportGroup Label="ExtensionSettings">
37 + </ImportGroup>
38 + <ImportGroup Label="Shared">
39 + <Import Project="..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" />
40 + </ImportGroup>
41 + <PropertyGroup>
42 + <ProjectAdditionalLinkLibraries>
43 + </ProjectAdditionalLinkLibraries>
44 + </PropertyGroup>
45 + <ItemGroup>
46 + <ClCompile Include="precomp.cpp">
47 + <PrecompiledHeader>Create</PrecompiledHeader>
48 + </ClCompile>
49 + <ClCompile Include="ShutdownEngine.cpp" />
50 + <ClCompile Include="ExampleTestEngine.cpp" />
51 + <ClCompile Include="TestEngine.cpp" />
52 + </ItemGroup>
53 + <ItemGroup>
54 + <ClInclude Include="precomp.h" />
55 + <ClInclude Include="TestEngine.h" />
56 + </ItemGroup>
57 + <ItemGroup>
58 + <None Include="packages.config" />
59 + </ItemGroup>
60 + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
61 + <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
62 + <PropertyGroup>
63 + <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>
64 + </PropertyGroup>
65 + <Error Condition="!Exists('..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets'))" />
66 + <Error Condition="!Exists('..\..\..\..\packages\WixToolset.BalUtil.4.0.12\build\WixToolset.BalUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.BalUtil.4.0.12\build\WixToolset.BalUtil.props'))" />
67 + <Error Condition="!Exists('..\..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.10\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.10\build\WixToolset.BootstrapperCore.Native.props'))" />
68 + <Error Condition="!Exists('..\..\..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props'))" />
69 + </Target>
70 +</Project>
\ No newline at end of file
src/test/examples/TestEngine/ExampleTestEngine.cpp new
+22
@@ -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 +#include "precomp.h"
4 +
5 +int __cdecl wmain(int argc, LPWSTR argv[])
6 +{
7 + HRESULT hr = E_INVALIDARG;
8 +
9 + ConsoleInitialize();
10 +
11 + if (argc != 2)
12 + {
13 + ConsoleWriteError(hr, CONSOLE_COLOR_RED, "Usage: Example.TestEngine.exe BA.dll");
14 + }
15 + else
16 + {
17 + hr = RunShutdownEngine(argv[1]);
18 + }
19 +
20 + ConsoleUninitialize();
21 + return HRESULT_CODE(hr);
22 +}
src/test/examples/TestEngine/ShutdownEngine.cpp new
+23
@@ -0,0 +1,23 @@
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 wzBAFilePath
7 + )
8 +{
9 + HRESULT hr = S_OK;
10 + TestEngine* pTestEngine = NULL;
11 +
12 + pTestEngine = new TestEngine();
13 + ConsoleExitOnNull(pTestEngine, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to create new test engine.");
14 +
15 + hr = pTestEngine->LoadBA(wzBAFilePath);
16 + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA.");
17 +
18 + hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER);
19 + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown.");
20 +
21 +LExit:
22 + return hr;
23 +}
src/test/examples/TestEngine/TestEngine.cpp new
+117
@@ -0,0 +1,117 @@
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::LoadBA(
6 + __in LPCWSTR wzBAFilePath
7 + )
8 +{
9 + HRESULT hr = S_OK;
10 + BOOTSTRAPPER_COMMAND command = { };
11 + BOOTSTRAPPER_CREATE_ARGS args = { };
12 + HMODULE hBAModule = NULL;
13 + PFN_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = NULL;
14 +
15 + if (m_pCreateResults)
16 + {
17 + ExitFunction1(hr = E_INVALIDSTATE);
18 + }
19 +
20 + LogInitialize(::GetModuleHandleW(NULL));
21 +
22 + hr = LogOpen(NULL, L"ExampleTestEngine", NULL, L"txt", FALSE, FALSE, NULL);
23 + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to open log.");
24 +
25 + m_pCreateResults = static_cast<BOOTSTRAPPER_CREATE_RESULTS*>(MemAlloc(sizeof(BOOTSTRAPPER_CREATE_RESULTS), TRUE));
26 +
27 + command.cbSize = sizeof(BOOTSTRAPPER_COMMAND);
28 +
29 + args.cbSize = sizeof(BOOTSTRAPPER_CREATE_ARGS);
30 + args.pCommand = &command;
31 + args.pfnBootstrapperEngineProc = TestEngine::EngineProc;
32 + args.pvBootstrapperEngineProcContext = this;
33 + args.qwEngineAPIVersion = MAKEQWORDVERSION(0, 0, 0, 1);
34 +
35 + m_pCreateResults->cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS);
36 +
37 + hBAModule = ::LoadLibraryExW(wzBAFilePath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
38 + ExitOnNullWithLastError(hBAModule, hr, "Failed to load BA dll.");
39 +
40 + pfnCreate = (PFN_BOOTSTRAPPER_APPLICATION_CREATE)::GetProcAddress(hBAModule, "BootstrapperApplicationCreate");
41 + ConsoleExitOnNull(pfnCreate, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to get address for BootstrapperApplicationCreate.");
42 +
43 + hr = pfnCreate(&args, m_pCreateResults);
44 + ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure on BootstrapperApplicationCreate.");
45 +
46 +LExit:
47 + return hr;
48 +}
49 +
50 +HRESULT TestEngine::Log(
51 + __in LPCWSTR wzMessage
52 + )
53 +{
54 + return ConsoleWriteLine(CONSOLE_COLOR_NORMAL, "%ls", wzMessage);
55 +}
56 +
57 +HRESULT TestEngine::SendShutdownEvent(
58 + __in BOOTSTRAPPER_SHUTDOWN_ACTION defaultAction
59 + )
60 +{
61 + HRESULT hr = S_OK;
62 + BA_ONSHUTDOWN_ARGS shutdownArgs = { };
63 + BA_ONSHUTDOWN_RESULTS shutdownResults = { };
64 + shutdownArgs.cbSize = sizeof(BA_ONSHUTDOWN_ARGS);
65 + shutdownResults.action = defaultAction;
66 + shutdownResults.cbSize = sizeof(BA_ONSHUTDOWN_RESULTS);
67 + hr = m_pCreateResults->pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, &shutdownArgs, &shutdownResults, m_pCreateResults->pvBootstrapperApplicationProcContext);
68 + return hr;
69 +}
70 +
71 +HRESULT TestEngine::BAEngineLog(
72 + __in TestEngine* pContext,
73 + __in BAENGINE_LOG_ARGS* pArgs,
74 + __in BAENGINE_LOG_RESULTS* /*pResults*/
75 + )
76 +{
77 + return pContext->Log(pArgs->wzMessage);
78 +}
79 +
80 +HRESULT WINAPI TestEngine::EngineProc(
81 + __in BOOTSTRAPPER_ENGINE_MESSAGE message,
82 + __in const LPVOID pvArgs,
83 + __inout LPVOID pvResults,
84 + __in_opt LPVOID pvContext
85 + )
86 +{
87 + HRESULT hr = S_OK;
88 + TestEngine* pContext = (TestEngine*)pvContext;
89 +
90 + if (!pContext || !pvArgs || !pvResults)
91 + {
92 + ExitFunction1(hr = E_INVALIDARG);
93 + }
94 +
95 + switch (message)
96 + {
97 + case BOOTSTRAPPER_ENGINE_MESSAGE_LOG:
98 + hr = BAEngineLog(pContext, reinterpret_cast<BAENGINE_LOG_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_LOG_RESULTS*>(pvResults));
99 + break;
100 + default:
101 + hr = E_NOTIMPL;
102 + break;
103 + }
104 +
105 +LExit:
106 + return hr;
107 +}
108 +
109 +TestEngine::TestEngine()
110 +{
111 + m_pCreateResults = NULL;
112 +}
113 +
114 +TestEngine::~TestEngine()
115 +{
116 + ReleaseMem(m_pCreateResults);
117 +}
\ No newline at end of file
src/test/examples/TestEngine/TestEngine.h new
+42
@@ -0,0 +1,42 @@
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 "precomp.h"
5 +
6 +class TestEngine
7 +{
8 +public:
9 + HRESULT LoadBA(
10 + __in LPCWSTR wzBAFilePath
11 + );
12 +
13 + HRESULT Log(
14 + __in LPCWSTR wzMessage
15 + );
16 +
17 + HRESULT SendShutdownEvent(
18 + __in BOOTSTRAPPER_SHUTDOWN_ACTION defaultAction
19 + );
20 +
21 +private:
22 + static HRESULT BAEngineLog(
23 + __in TestEngine* pContext,
24 + __in BAENGINE_LOG_ARGS* pArgs,
25 + __in BAENGINE_LOG_RESULTS* /*pResults*/
26 + );
27 +
28 + static HRESULT WINAPI EngineProc(
29 + __in BOOTSTRAPPER_ENGINE_MESSAGE message,
30 + __in const LPVOID pvArgs,
31 + __inout LPVOID pvResults,
32 + __in_opt LPVOID pvContext
33 + );
34 +
35 +public:
36 + TestEngine();
37 +
38 + ~TestEngine();
39 +
40 +private:
41 + BOOTSTRAPPER_CREATE_RESULTS* m_pCreateResults;
42 +};
\ No newline at end of file
src/test/examples/TestEngine/packages.config new
+7
@@ -0,0 +1,7 @@
1 +<?xml version="1.0" encoding="utf-8"?>
2 +<packages>
3 + <package id="Nerdbank.GitVersioning" version="2.1.65" targetFramework="native" developmentDependency="true" />
4 + <package id="WixToolset.BootstrapperCore.Native" version="4.0.10" targetFramework="native" />
5 + <package id="WixToolset.BalUtil" version="4.0.12" targetFramework="native" />
6 + <package id="WixToolset.DUtil" version="4.0.18" targetFramework="native" />
7 +</packages>
\ No newline at end of file
src/test/examples/TestEngine/precomp.cpp renamed
src/test/examples/TestEngine/precomp.h renamed
+8 -5
@@ -1,16 +1,19 @@
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 -
4 #include <windows.h>
6 -#include <msiquery.h>
5 +#include <MsiQuery.h>
6
7 #include "dutil.h"
8 +#include "conutil.h"
9 #include "logutil.h"
10 +#include "memutil.h"
11
12 #include "BootstrapperEngine.h"
13 #include "BootstrapperApplication.h"
14
14 -#include "EngineForTest.h"
15 -#include "TestManagedBootstrapperApplication.h"
16 -#include "TestManagedBootstrapperApplicationFactory.h"
15 +#include "TestEngine.h"
16 +
17 +HRESULT RunShutdownEngine(
18 + __in LPCWSTR wzBAFilePath
19 + );