aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2020-04-29 19:28:50 +1000
committerSean Hall <r.sean.hall@gmail.com>2020-04-29 19:53:29 +1000
commit39e930d9aaff250e0fd5019eeedaa40717a6c6fe (patch)
treebc0865bc6c9ced1b4a06b408ff60cb83ef73cad3
parentf4b14ff16f78435285bb20f16d5d62b902e6ba17 (diff)
downloadwix-39e930d9aaff250e0fd5019eeedaa40717a6c6fe.tar.gz
wix-39e930d9aaff250e0fd5019eeedaa40717a6c6fe.tar.bz2
wix-39e930d9aaff250e0fd5019eeedaa40717a6c6fe.zip
Add DotNetCoreBootstrapperApplicationHost for an SCD-style .NET Core BA.
-rw-r--r--Bal.wixext.sln56
-rw-r--r--src/Custom.Build.props8
-rw-r--r--src/WixToolset.Dnc.Host/BootstrapperApplicationFactory.cs87
-rw-r--r--src/WixToolset.Dnc.Host/DnchostAssemblyLoadContext.cs58
-rw-r--r--src/WixToolset.Dnc.Host/Exceptions.cs145
-rw-r--r--src/WixToolset.Dnc.Host/IBootstrapperApplicationFactory.cs16
-rw-r--r--src/WixToolset.Dnc.Host/NativeMethods.cs18
-rw-r--r--src/WixToolset.Dnc.Host/WixToolset.Dnc.Host.csproj38
-rw-r--r--src/WixToolset.Mba.Host/BootstrapperApplicationFactory.cs3
-rw-r--r--src/WixToolset.Mba.Host/WixToolset.Mba.Host.csproj6
-rw-r--r--src/dnchost/coreclrhost.h137
-rw-r--r--src/dnchost/dnchost.cpp229
-rw-r--r--src/dnchost/dnchost.def6
-rw-r--r--src/dnchost/dnchost.h19
-rw-r--r--src/dnchost/dnchost.vcxproj77
-rw-r--r--src/dnchost/dncutil.cpp359
-rw-r--r--src/dnchost/dncutil.h36
-rw-r--r--src/dnchost/hostfxr.h96
-rw-r--r--src/dnchost/packages.config8
-rw-r--r--src/dnchost/precomp.cpp3
-rw-r--r--src/dnchost/precomp.h29
-rw-r--r--src/test/WixToolsetTest.ManagedHost/DncHostFixture.cs232
-rw-r--r--src/test/WixToolsetTest.ManagedHost/HarvestDirectoryToPayloadGroup.ps142
-rw-r--r--src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/HarvestedSCD.wxs235
-rw-r--r--src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/HarvestedTrimmedSCD.wxs113
-rw-r--r--src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/SelfContainedBundle.wxs12
-rw-r--r--src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/TrimmedSelfContainedBundle.wxs12
-rw-r--r--src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/HarvestedSCD.wxs235
-rw-r--r--src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/HarvestedTrimmedSCD.wxs113
-rw-r--r--src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/SelfContainedBundle.wxs12
-rw-r--r--src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/TrimmedSelfContainedBundle.wxs12
-rw-r--r--src/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj30
-rw-r--r--src/test/examples/EarliestCoreMBA/EarliestCoreBA.cs34
-rw-r--r--src/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs22
-rw-r--r--src/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj18
-rw-r--r--src/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj23
-rw-r--r--src/test/examples/LatestCoreMBA/LatestCoreBA.cs33
-rw-r--r--src/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs22
-rw-r--r--src/test/examples/TestEngine/TestEngine.cpp16
-rw-r--r--src/test/examples/TestEngine/precomp.h1
-rw-r--r--src/wixext/BalCompiler.cs9
-rw-r--r--src/wixext/Tuples/BalTupleDefinitions.cs15
-rw-r--r--src/wixext/Tuples/WixBalBAFactoryAssemblyTuple.cs47
-rw-r--r--src/wixext/bal.xsd17
-rw-r--r--src/wixlib/Dnc.wxs21
-rw-r--r--src/wixlib/bal.wixproj5
46 files changed, 2756 insertions, 9 deletions
diff --git a/Bal.wixext.sln b/Bal.wixext.sln
index 84c30661..b4b384af 100644
--- a/Bal.wixext.sln
+++ b/Bal.wixext.sln
@@ -13,6 +13,8 @@ Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "bal", "src\wixlib\bal.wixpr
13EndProject 13EndProject
14Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Bal.wixext", "src\wixext\WixToolset.Bal.wixext.csproj", "{BF720A63-9D7B-456E-B60C-8122852D9FED}" 14Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Bal.wixext", "src\wixext\WixToolset.Bal.wixext.csproj", "{BF720A63-9D7B-456E-B60C-8122852D9FED}"
15EndProject 15EndProject
16Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WixToolset.Dnc.Host", "src\WixToolset.Dnc.Host\WixToolset.Dnc.Host.csproj", "{0D780900-C2FF-4FA2-8CB5-8A19768724C5}"
17EndProject
16Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WixToolset.Mba.Host", "src\WixToolset.Mba.Host\WixToolset.Mba.Host.csproj", "{F2BA1935-70FA-4156-B161-FD03850B4FAA}" 18Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WixToolset.Mba.Host", "src\WixToolset.Mba.Host\WixToolset.Mba.Host.csproj", "{F2BA1935-70FA-4156-B161-FD03850B4FAA}"
17EndProject 19EndProject
18Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{C70E3534-A018-4D0A-A340-916C9777EEF7}" 20Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{C70E3534-A018-4D0A-A340-916C9777EEF7}"
@@ -27,6 +29,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.FullFramework4MBA",
27EndProject 29EndProject
28Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.Bal", "src\test\WixToolsetTest.Bal\WixToolsetTest.Bal.csproj", "{89D479FC-20DA-44D8-AE38-48F063223498}" 30Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.Bal", "src\test\WixToolsetTest.Bal\WixToolsetTest.Bal.csproj", "{89D479FC-20DA-44D8-AE38-48F063223498}"
29EndProject 31EndProject
32Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.EarliestCoreMBA", "src\test\examples\EarliestCoreMBA\Example.EarliestCoreMBA.csproj", "{1E86D8DF-DABD-4B6E-A812-64CD2040C73A}"
33EndProject
34Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "dnchost", "src\dnchost\dnchost.vcxproj", "{B6F70281-6583-4138-BB7F-AABFEBBB3CA2}"
35EndProject
36Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.LatestCoreMBA", "src\test\examples\LatestCoreMBA\Example.LatestCoreMBA.csproj", "{A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}"
37EndProject
30Global 38Global
31 GlobalSection(SolutionConfigurationPlatforms) = preSolution 39 GlobalSection(SolutionConfigurationPlatforms) = preSolution
32 Debug|Any CPU = Debug|Any CPU 40 Debug|Any CPU = Debug|Any CPU
@@ -89,6 +97,18 @@ Global
89 {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x64.Build.0 = Release|Any CPU 97 {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x64.Build.0 = Release|Any CPU
90 {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x86.ActiveCfg = Release|Any CPU 98 {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x86.ActiveCfg = Release|Any CPU
91 {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x86.Build.0 = Release|Any CPU 99 {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x86.Build.0 = Release|Any CPU
100 {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
101 {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
102 {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|x64.ActiveCfg = Debug|Any CPU
103 {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|x64.Build.0 = Debug|Any CPU
104 {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|x86.ActiveCfg = Debug|Any CPU
105 {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|x86.Build.0 = Debug|Any CPU
106 {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
107 {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|Any CPU.Build.0 = Release|Any CPU
108 {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|x64.ActiveCfg = Release|Any CPU
109 {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|x64.Build.0 = Release|Any CPU
110 {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|x86.ActiveCfg = Release|Any CPU
111 {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|x86.Build.0 = Release|Any CPU
92 {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 112 {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
93 {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|Any CPU.Build.0 = Debug|Any CPU 113 {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|Any CPU.Build.0 = Debug|Any CPU
94 {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|x64.ActiveCfg = Debug|Any CPU 114 {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -161,6 +181,40 @@ Global
161 {89D479FC-20DA-44D8-AE38-48F063223498}.Release|x64.Build.0 = Release|Any CPU 181 {89D479FC-20DA-44D8-AE38-48F063223498}.Release|x64.Build.0 = Release|Any CPU
162 {89D479FC-20DA-44D8-AE38-48F063223498}.Release|x86.ActiveCfg = Release|Any CPU 182 {89D479FC-20DA-44D8-AE38-48F063223498}.Release|x86.ActiveCfg = Release|Any CPU
163 {89D479FC-20DA-44D8-AE38-48F063223498}.Release|x86.Build.0 = Release|Any CPU 183 {89D479FC-20DA-44D8-AE38-48F063223498}.Release|x86.Build.0 = Release|Any CPU
184 {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
185 {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Debug|Any CPU.Build.0 = Debug|Any CPU
186 {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Debug|x64.ActiveCfg = Debug|Any CPU
187 {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Debug|x64.Build.0 = Debug|Any CPU
188 {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Debug|x86.ActiveCfg = Debug|Any CPU
189 {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Debug|x86.Build.0 = Debug|Any CPU
190 {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Release|Any CPU.ActiveCfg = Release|Any CPU
191 {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Release|Any CPU.Build.0 = Release|Any CPU
192 {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Release|x64.ActiveCfg = Release|Any CPU
193 {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Release|x64.Build.0 = Release|Any CPU
194 {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Release|x86.ActiveCfg = Release|Any CPU
195 {1E86D8DF-DABD-4B6E-A812-64CD2040C73A}.Release|x86.Build.0 = Release|Any CPU
196 {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Debug|Any CPU.ActiveCfg = Debug|Win32
197 {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Debug|Any CPU.Build.0 = Debug|Win32
198 {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Debug|x64.ActiveCfg = Debug|Win32
199 {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Debug|x86.ActiveCfg = Debug|Win32
200 {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Debug|x86.Build.0 = Debug|Win32
201 {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Release|Any CPU.ActiveCfg = Release|Win32
202 {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Release|Any CPU.Build.0 = Release|Win32
203 {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Release|x64.ActiveCfg = Release|Win32
204 {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Release|x86.ActiveCfg = Release|Win32
205 {B6F70281-6583-4138-BB7F-AABFEBBB3CA2}.Release|x86.Build.0 = Release|Win32
206 {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
207 {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Debug|Any CPU.Build.0 = Debug|Any CPU
208 {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Debug|x64.ActiveCfg = Debug|Any CPU
209 {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Debug|x64.Build.0 = Debug|Any CPU
210 {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Debug|x86.ActiveCfg = Debug|Any CPU
211 {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Debug|x86.Build.0 = Debug|Any CPU
212 {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Release|Any CPU.ActiveCfg = Release|Any CPU
213 {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Release|Any CPU.Build.0 = Release|Any CPU
214 {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Release|x64.ActiveCfg = Release|Any CPU
215 {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Release|x64.Build.0 = Release|Any CPU
216 {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Release|x86.ActiveCfg = Release|Any CPU
217 {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618}.Release|x86.Build.0 = Release|Any CPU
164 EndGlobalSection 218 EndGlobalSection
165 GlobalSection(SolutionProperties) = preSolution 219 GlobalSection(SolutionProperties) = preSolution
166 HideSolutionNode = FALSE 220 HideSolutionNode = FALSE
@@ -169,6 +223,8 @@ Global
169 {CC4236FC-226E-4232-AB50-24CBEC4D314D} = {C70E3534-A018-4D0A-A340-916C9777EEF7} 223 {CC4236FC-226E-4232-AB50-24CBEC4D314D} = {C70E3534-A018-4D0A-A340-916C9777EEF7}
170 {3D44B67D-A475-49BA-8310-E39F6C117CC9} = {C70E3534-A018-4D0A-A340-916C9777EEF7} 224 {3D44B67D-A475-49BA-8310-E39F6C117CC9} = {C70E3534-A018-4D0A-A340-916C9777EEF7}
171 {44297646-706D-4508-8E96-1B35B109694C} = {C70E3534-A018-4D0A-A340-916C9777EEF7} 225 {44297646-706D-4508-8E96-1B35B109694C} = {C70E3534-A018-4D0A-A340-916C9777EEF7}
226 {1E86D8DF-DABD-4B6E-A812-64CD2040C73A} = {C70E3534-A018-4D0A-A340-916C9777EEF7}
227 {A4247D9D-3CC9-4BE1-B23A-BEC166AF3618} = {C70E3534-A018-4D0A-A340-916C9777EEF7}
172 EndGlobalSection 228 EndGlobalSection
173 GlobalSection(ExtensibilityGlobals) = postSolution 229 GlobalSection(ExtensibilityGlobals) = postSolution
174 SolutionGuid = {74046961-48BF-467A-A6C2-F886C75CE0BE} 230 SolutionGuid = {74046961-48BF-467A-A6C2-F886C75CE0BE}
diff --git a/src/Custom.Build.props b/src/Custom.Build.props
index f4352014..66e74d81 100644
--- a/src/Custom.Build.props
+++ b/src/Custom.Build.props
@@ -2,8 +2,10 @@
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. --> 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 3
4<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 4<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
5 <PropertyGroup> 5 <PropertyGroup Condition="$(ProjectName.StartsWith('Example.')) And '$(MSBuildProjectExtension)'=='.csproj' ">
6 <OutputPath Condition="$(ProjectName.StartsWith('Example.')) And '$(MSBuildProjectExtension)'=='.csproj' ">$(OutputPath)examples\$(ProjectName)\</OutputPath> 6 <OutputPath>$(OutputPath)examples\$(ProjectName)\</OutputPath>
7 <OutDir Condition="$(ProjectName.StartsWith('Example.')) And '$(MSBuildProjectExtension)'=='.vcxproj' ">$(OutDir)examples\$(ProjectName)\</OutDir> 7 </PropertyGroup>
8 <PropertyGroup Condition="$(ProjectName.StartsWith('Example.')) And '$(MSBuildProjectExtension)'=='.vcxproj' ">
9 <OutDir>$(OutDir)examples\$(ProjectName)\</OutDir>
8 </PropertyGroup> 10 </PropertyGroup>
9</Project> 11</Project>
diff --git a/src/WixToolset.Dnc.Host/BootstrapperApplicationFactory.cs b/src/WixToolset.Dnc.Host/BootstrapperApplicationFactory.cs
new file mode 100644
index 00000000..0c6ea367
--- /dev/null
+++ b/src/WixToolset.Dnc.Host/BootstrapperApplicationFactory.cs
@@ -0,0 +1,87 @@
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
3namespace WixToolset.Dnc.Host
4{
5 using System;
6 using System.Linq;
7 using System.Reflection;
8 using System.Runtime.InteropServices;
9
10 /// <summary>
11 /// Entry point for the .NET Core host to create and return the BA to the engine.
12 /// Reflection is used instead of referencing WixToolset.Mba.Core directly to avoid requiring it in the AssemblyLoadContext.
13 /// </summary>
14 public sealed class BootstrapperApplicationFactory : IBootstrapperApplicationFactory
15 {
16 private string baFactoryAssemblyName;
17 private string baFactoryAssemblyPath;
18
19 public BootstrapperApplicationFactory(string baFactoryAssemblyName, string baFactoryAssemblyPath)
20 {
21 this.baFactoryAssemblyName = baFactoryAssemblyName;
22 this.baFactoryAssemblyPath = baFactoryAssemblyPath;
23 }
24
25 /// <summary>
26 /// Loads the bootstrapper application assembly and calls its IBootstrapperApplicationFactory.Create method.
27 /// </summary>
28 /// <param name="pArgs">Pointer to BOOTSTRAPPER_CREATE_ARGS struct.</param>
29 /// <param name="pResults">Pointer to BOOTSTRAPPER_CREATE_RESULTS struct.</param>
30 /// <exception cref="MissingAttributeException">The bootstrapper application assembly
31 /// does not define the <see cref="BootstrapperApplicationFactoryAttribute"/>.</exception>
32 public void Create(IntPtr pArgs, IntPtr pResults)
33 {
34 // Load the BA's IBootstrapperApplicationFactory.
35 var baFactoryType = BootstrapperApplicationFactory.GetBAFactoryTypeFromAssembly(this.baFactoryAssemblyName, this.baFactoryAssemblyPath);
36 var baFactory = Activator.CreateInstance(baFactoryType);
37 if (null == baFactory)
38 {
39 throw new InvalidBootstrapperApplicationFactoryException();
40 }
41
42 var createMethod = baFactoryType.GetMethod(nameof(Create), new[] { typeof(IntPtr), typeof(IntPtr) });
43 if (null == createMethod)
44 {
45 throw new InvalidBootstrapperApplicationFactoryException();
46 }
47 createMethod.Invoke(baFactory, new object[] { pArgs, pResults });
48 }
49
50 /// <summary>
51 /// Locates the <see cref="BootstrapperApplicationFactoryAttribute"/> and returns the specified type.
52 /// </summary>
53 /// <param name="assemblyName">The assembly that defines the IBootstrapperApplicationFactory implementation.</param>
54 /// <returns>The bootstrapper application factory <see cref="Type"/>.</returns>
55 private static Type GetBAFactoryTypeFromAssembly(string assemblyName, string assemblyPath)
56 {
57 // The default ALC shouldn't need help loading the assembly, since the host should have provided the deps.json
58 // when starting the runtime. But it doesn't hurt so keep this in case an isolated ALC is ever needed.
59 var alc = new DnchostAssemblyLoadContext(assemblyPath, false);
60 var asm = alc.LoadFromAssemblyName(new AssemblyName(assemblyName));
61
62 var attr = asm.GetCustomAttributes()
63 .Where(a => a.GetType().FullName == "WixToolset.Mba.Core.BootstrapperApplicationFactoryAttribute")
64 .SingleOrDefault();
65
66 if (null == attr)
67 {
68 throw new MissingAttributeException();
69 }
70
71 var baFactoryTypeProperty = attr.GetType().GetProperty("BootstrapperApplicationFactoryType", typeof(Type));
72 if (baFactoryTypeProperty == null || baFactoryTypeProperty.GetMethod == null)
73 {
74 throw new MissingAttributeException();
75 }
76
77 var baFactoryType = (Type)baFactoryTypeProperty.GetMethod.Invoke(attr, null);
78 return baFactoryType;
79 }
80
81 // Entry point for the DNC host.
82 public static IBootstrapperApplicationFactory CreateBAFactory([MarshalAs(UnmanagedType.LPWStr)] string baFactoryAssemblyName, [MarshalAs(UnmanagedType.LPWStr)] string baFactoryAssemblyPath)
83 {
84 return new BootstrapperApplicationFactory(baFactoryAssemblyName, baFactoryAssemblyPath);
85 }
86 }
87}
diff --git a/src/WixToolset.Dnc.Host/DnchostAssemblyLoadContext.cs b/src/WixToolset.Dnc.Host/DnchostAssemblyLoadContext.cs
new file mode 100644
index 00000000..1a383058
--- /dev/null
+++ b/src/WixToolset.Dnc.Host/DnchostAssemblyLoadContext.cs
@@ -0,0 +1,58 @@
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
3namespace WixToolset.Dnc.Host
4{
5 using System;
6 using System.Reflection;
7 using System.Runtime.Loader;
8
9 public sealed class DnchostAssemblyLoadContext : AssemblyLoadContext
10 {
11 private readonly AssemblyDependencyResolver resolver;
12
13 public DnchostAssemblyLoadContext(string assemblyPath, bool isolateFromDefault)
14 : base(nameof(DnchostAssemblyLoadContext), isolateFromDefault)
15 {
16 this.resolver = new AssemblyDependencyResolver(assemblyPath);
17
18 if (!this.IsCollectible)
19 {
20 AssemblyLoadContext.Default.Resolving += this.ResolveAssembly;
21 AssemblyLoadContext.Default.ResolvingUnmanagedDll += this.ResolveUnmanagedDll;
22 }
23 }
24
25 private Assembly ResolveAssembly(AssemblyLoadContext defaultAlc, AssemblyName assemblyName)
26 {
27 var path = this.resolver.ResolveAssemblyToPath(assemblyName);
28 if (path != null)
29 {
30 var targetAlc = this.IsCollectible ? this : defaultAlc;
31 return targetAlc.LoadFromAssemblyPath(path);
32 }
33
34 return null;
35 }
36
37 private IntPtr ResolveUnmanagedDll(Assembly assembly, string unmanagedDllName)
38 {
39 var path = this.resolver.ResolveUnmanagedDllToPath(unmanagedDllName);
40 if (path != null)
41 {
42 return this.LoadUnmanagedDllFromPath(path);
43 }
44
45 return IntPtr.Zero;
46 }
47
48 protected override Assembly Load(AssemblyName assemblyName)
49 {
50 return this.ResolveAssembly(AssemblyLoadContext.Default, assemblyName);
51 }
52
53 protected override IntPtr LoadUnmanagedDll(string unmanagedDllName)
54 {
55 return this.ResolveUnmanagedDll(null, unmanagedDllName);
56 }
57 }
58}
diff --git a/src/WixToolset.Dnc.Host/Exceptions.cs b/src/WixToolset.Dnc.Host/Exceptions.cs
new file mode 100644
index 00000000..32d4d4c5
--- /dev/null
+++ b/src/WixToolset.Dnc.Host/Exceptions.cs
@@ -0,0 +1,145 @@
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
3namespace WixToolset.Dnc.Host
4{
5 using System;
6 using System.Runtime.Serialization;
7
8 /// <summary>
9 /// Base class for exception returned to the bootstrapper application host.
10 /// </summary>
11 [Serializable]
12 public abstract class BootstrapperException : Exception
13 {
14 /// <summary>
15 /// Creates an instance of the <see cref="BootstrapperException"/> base class with the given HRESULT.
16 /// </summary>
17 /// <param name="hr">The HRESULT for the exception that is used by the bootstrapper application host.</param>
18 public BootstrapperException(int hr)
19 {
20 this.HResult = hr;
21 }
22
23 /// <summary>
24 /// Initializes a new instance of the <see cref="BootstrapperException"/> class.
25 /// </summary>
26 /// <param name="message">Exception message.</param>
27 public BootstrapperException(string message)
28 : base(message)
29 {
30 }
31
32 /// <summary>
33 /// Initializes a new instance of the <see cref="BootstrapperException"/> class.
34 /// </summary>
35 /// <param name="message">Exception message</param>
36 /// <param name="innerException">Inner exception associated with this one</param>
37 public BootstrapperException(string message, Exception innerException)
38 : base(message, innerException)
39 {
40 }
41
42 /// <summary>
43 /// Initializes a new instance of the <see cref="BootstrapperException"/> class.
44 /// </summary>
45 /// <param name="info">Serialization information for this exception</param>
46 /// <param name="context">Streaming context to serialize to</param>
47 protected BootstrapperException(SerializationInfo info, StreamingContext context)
48 : base(info, context)
49 {
50 }
51 }
52
53 /// <summary>
54 /// The bootstrapper application assembly loaded by the host does not contain exactly one instance of the
55 /// <see cref="Core.BootstrapperApplicationFactoryAttribute"/> class.
56 /// </summary>
57 /// <seealso cref="Core.BootstrapperApplicationFactoryAttribute"/>
58 [Serializable]
59 public class MissingAttributeException : BootstrapperException
60 {
61 /// <summary>
62 /// Creates a new instance of the <see cref="MissingAttributeException"/> class.
63 /// </summary>
64 public MissingAttributeException()
65 : base(NativeMethods.E_NOTFOUND)
66 {
67 }
68
69 /// <summary>
70 /// Initializes a new instance of the <see cref="MissingAttributeException"/> class.
71 /// </summary>
72 /// <param name="message">Exception message.</param>
73 public MissingAttributeException(string message)
74 : base(message)
75 {
76 }
77
78 /// <summary>
79 /// Initializes a new instance of the <see cref="MissingAttributeException"/> class.
80 /// </summary>
81 /// <param name="message">Exception message</param>
82 /// <param name="innerException">Inner exception associated with this one</param>
83 public MissingAttributeException(string message, Exception innerException)
84 : base(message, innerException)
85 {
86 }
87
88 /// <summary>
89 /// Initializes a new instance of the <see cref="MissingAttributeException"/> class.
90 /// </summary>
91 /// <param name="info">Serialization information for this exception</param>
92 /// <param name="context">Streaming context to serialize to</param>
93 protected MissingAttributeException(SerializationInfo info, StreamingContext context)
94 : base(info, context)
95 {
96 }
97 }
98
99 /// <summary>
100 /// The bootstrapper application factory specified by the <see cref="Core.BootstrapperApplicationFactoryAttribute"/>
101 /// does not extend the <see cref="Core.IBootstrapperApplicationFactory"/> base class.
102 /// </summary>
103 /// <seealso cref="Core.BaseBootstrapperApplicationFactory"/>
104 /// <seealso cref="Core.BootstrapperApplicationFactoryAttribute"/>
105 [Serializable]
106 public class InvalidBootstrapperApplicationFactoryException : BootstrapperException
107 {
108 /// <summary>
109 /// Creates a new instance of the <see cref="InvalidBootstrapperApplicationFactoryException"/> class.
110 /// </summary>
111 public InvalidBootstrapperApplicationFactoryException()
112 : base(NativeMethods.E_UNEXPECTED)
113 {
114 }
115
116 /// <summary>
117 /// Initializes a new instance of the <see cref="InvalidBootstrapperApplicationFactoryException"/> class.
118 /// </summary>
119 /// <param name="message">Exception message.</param>
120 public InvalidBootstrapperApplicationFactoryException(string message)
121 : base(message)
122 {
123 }
124
125 /// <summary>
126 /// Initializes a new instance of the <see cref="InvalidBootstrapperApplicationFactoryException"/> class.
127 /// </summary>
128 /// <param name="message">Exception message</param>
129 /// <param name="innerException">Inner exception associated with this one</param>
130 public InvalidBootstrapperApplicationFactoryException(string message, Exception innerException)
131 : base(message, innerException)
132 {
133 }
134
135 /// <summary>
136 /// Initializes a new instance of the <see cref="InvalidBootstrapperApplicationFactoryException"/> class.
137 /// </summary>
138 /// <param name="info">Serialization information for this exception</param>
139 /// <param name="context">Streaming context to serialize to</param>
140 protected InvalidBootstrapperApplicationFactoryException(SerializationInfo info, StreamingContext context)
141 : base(info, context)
142 {
143 }
144 }
145}
diff --git a/src/WixToolset.Dnc.Host/IBootstrapperApplicationFactory.cs b/src/WixToolset.Dnc.Host/IBootstrapperApplicationFactory.cs
new file mode 100644
index 00000000..96731192
--- /dev/null
+++ b/src/WixToolset.Dnc.Host/IBootstrapperApplicationFactory.cs
@@ -0,0 +1,16 @@
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
3namespace WixToolset.Dnc.Host
4{
5 using System;
6 using System.Runtime.InteropServices;
7
8 [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
9 public interface IBootstrapperApplicationFactory
10 {
11 void Create(
12 IntPtr pArgs,
13 IntPtr pResults
14 );
15 }
16}
diff --git a/src/WixToolset.Dnc.Host/NativeMethods.cs b/src/WixToolset.Dnc.Host/NativeMethods.cs
new file mode 100644
index 00000000..6dc393c6
--- /dev/null
+++ b/src/WixToolset.Dnc.Host/NativeMethods.cs
@@ -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
3namespace WixToolset.Dnc.Host
4{
5 using System;
6 using System.Runtime.InteropServices;
7
8 /// <summary>
9 /// Contains native constants, functions, and structures for this assembly.
10 /// </summary>
11 internal static class NativeMethods
12 {
13 #region Error Constants
14 internal const int E_NOTFOUND = unchecked((int)0x80070490);
15 internal const int E_UNEXPECTED = unchecked((int)0x8000ffff);
16 #endregion
17 }
18}
diff --git a/src/WixToolset.Dnc.Host/WixToolset.Dnc.Host.csproj b/src/WixToolset.Dnc.Host/WixToolset.Dnc.Host.csproj
new file mode 100644
index 00000000..09580c2d
--- /dev/null
+++ b/src/WixToolset.Dnc.Host/WixToolset.Dnc.Host.csproj
@@ -0,0 +1,38 @@
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.0</TargetFramework>
7 <RootNamespace>WixToolset.Dnc.Host</RootNamespace>
8 <Description>WiX Toolset .NET Core BA Host</Description>
9 <Title>WiX Toolset .NET Core BA Host</Title>
10 </PropertyGroup>
11
12 <ItemGroup>
13 <HeaderPath Include="$(BaseOutputPath)obj\$(AssemblyName).h">
14 <Visible>False</Visible>
15 </HeaderPath>
16 </ItemGroup>
17
18 <Target Name="GenerateIdentityHeader" AfterTargets="Build" Inputs="$(TargetPath)" Outputs="@(HeaderPath)">
19 <GetAssemblyIdentity AssemblyFiles="$(TargetPath)">
20 <Output TaskParameter="Assemblies" ItemName="AssemblyIdentity" />
21 </GetAssemblyIdentity>
22 <ItemGroup>
23 <Line Include='#define DNC_ASSEMBLY_FILE_NAME L"$(AssemblyName).dll"' />
24 <Line Include='#define DNC_ASSEMBLY_FULL_NAME "%(AssemblyIdentity.Identity)"' />
25 <Line Include='#define DNC_ENTRY_TYPE "$(RootNamespace).BootstrapperApplicationFactory"' />
26 <Line Include='#define DNC_STATIC_ENTRY_METHOD "CreateBAFactory"' />
27 </ItemGroup>
28 <Message Importance="normal" Text="Generating identity definitions into @(HeaderPath->'%(FullPath)')" />
29 <WriteLinesToFile File="@(HeaderPath)" Lines="@(Line)" Overwrite="True" />
30 <ItemGroup>
31 <FileWrites Include="@(HeaderPath)" />
32 </ItemGroup>
33 </Target>
34
35 <ItemGroup>
36 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" />
37 </ItemGroup>
38</Project>
diff --git a/src/WixToolset.Mba.Host/BootstrapperApplicationFactory.cs b/src/WixToolset.Mba.Host/BootstrapperApplicationFactory.cs
index 9385d1d1..78e68bd9 100644
--- a/src/WixToolset.Mba.Host/BootstrapperApplicationFactory.cs
+++ b/src/WixToolset.Mba.Host/BootstrapperApplicationFactory.cs
@@ -9,13 +9,14 @@ namespace WixToolset.Mba.Host
9 using WixToolset.Mba.Core; 9 using WixToolset.Mba.Core;
10 10
11 /// <summary> 11 /// <summary>
12 /// Entry point for the MBA host to create and return the BA to the engine. 12 /// Entry point for the managed host to create and return the BA to the engine.
13 /// </summary> 13 /// </summary>
14 [ClassInterface(ClassInterfaceType.None)] 14 [ClassInterface(ClassInterfaceType.None)]
15 public sealed class BootstrapperApplicationFactory : MarshalByRefObject, IBootstrapperApplicationFactory 15 public sealed class BootstrapperApplicationFactory : MarshalByRefObject, IBootstrapperApplicationFactory
16 { 16 {
17 /// <summary> 17 /// <summary>
18 /// Creates a new instance of the <see cref="BootstrapperApplicationFactory"/> class. 18 /// Creates a new instance of the <see cref="BootstrapperApplicationFactory"/> class.
19 /// Entry point for the MBA host.
19 /// </summary> 20 /// </summary>
20 public BootstrapperApplicationFactory() 21 public BootstrapperApplicationFactory()
21 { 22 {
diff --git a/src/WixToolset.Mba.Host/WixToolset.Mba.Host.csproj b/src/WixToolset.Mba.Host/WixToolset.Mba.Host.csproj
index 4b257195..65467acc 100644
--- a/src/WixToolset.Mba.Host/WixToolset.Mba.Host.csproj
+++ b/src/WixToolset.Mba.Host/WixToolset.Mba.Host.csproj
@@ -60,9 +60,9 @@
60 <Output TaskParameter="Assemblies" ItemName="AssemblyIdentity" /> 60 <Output TaskParameter="Assemblies" ItemName="AssemblyIdentity" />
61 </GetAssemblyIdentity> 61 </GetAssemblyIdentity>
62 <ItemGroup> 62 <ItemGroup>
63 <Line Include="#define MBA_ASSEMBLY_FULL_NAME L&quot;%(AssemblyIdentity.Identity)&quot;" /> 63 <Line Include='#define MBA_ASSEMBLY_FULL_NAME L"%(AssemblyIdentity.Identity)"' />
64 <Line Include="#define MBA_CONFIG_FILE_NAME L&quot;$(AssemblyName).config&quot;" /> 64 <Line Include='#define MBA_CONFIG_FILE_NAME L"$(AssemblyName).config"' />
65 <Line Include="#define MBA_ENTRY_TYPE L&quot;$(RootNamespace).BootstrapperApplicationFactory&quot;" /> 65 <Line Include='#define MBA_ENTRY_TYPE L"$(RootNamespace).BootstrapperApplicationFactory"' />
66 </ItemGroup> 66 </ItemGroup>
67 <Message Importance="normal" Text="Generating identity definitions into @(HeaderPath->'%(FullPath)')" /> 67 <Message Importance="normal" Text="Generating identity definitions into @(HeaderPath->'%(FullPath)')" />
68 <WriteLinesToFile File="@(HeaderPath)" Lines="@(Line)" Overwrite="True" /> 68 <WriteLinesToFile File="@(HeaderPath)" Lines="@(Line)" Overwrite="True" />
diff --git a/src/dnchost/coreclrhost.h b/src/dnchost/coreclrhost.h
new file mode 100644
index 00000000..07f28735
--- /dev/null
+++ b/src/dnchost/coreclrhost.h
@@ -0,0 +1,137 @@
1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5
6
7// ***** ABOUT THIS HEADER *****
8// **************************************************************************************
9//
10// This is the version on 2019-12-22 from
11// https://github.com/dotnet/runtime/blob/master/src/coreclr/src/coreclr/hosts/inc/coreclrhost.h
12//
13// **************************************************************************************
14// ****************************
15
16
17//
18// APIs for hosting CoreCLR
19//
20
21#ifndef __CORECLR_HOST_H__
22#define __CORECLR_HOST_H__
23
24#if defined(_WIN32) && defined(_M_IX86)
25#define CORECLR_CALLING_CONVENTION __stdcall
26#else
27#define CORECLR_CALLING_CONVENTION
28#endif
29
30// For each hosting API, we define a function prototype and a function pointer
31// The prototype is useful for implicit linking against the dynamic coreclr
32// library and the pointer for explicit dynamic loading (dlopen, LoadLibrary)
33#define CORECLR_HOSTING_API(function, ...) \
34 extern "C" int CORECLR_CALLING_CONVENTION function(__VA_ARGS__); \
35 typedef int (CORECLR_CALLING_CONVENTION *function##_ptr)(__VA_ARGS__)
36
37//
38// Initialize the CoreCLR. Creates and starts CoreCLR host and creates an app domain
39//
40// Parameters:
41// exePath - Absolute path of the executable that invoked the ExecuteAssembly (the native host application)
42// appDomainFriendlyName - Friendly name of the app domain that will be created to execute the assembly
43// propertyCount - Number of properties (elements of the following two arguments)
44// propertyKeys - Keys of properties of the app domain
45// propertyValues - Values of properties of the app domain
46// hostHandle - Output parameter, handle of the created host
47// domainId - Output parameter, id of the created app domain
48//
49// Returns:
50// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed
51//
52CORECLR_HOSTING_API(coreclr_initialize,
53 const char* exePath,
54 const char* appDomainFriendlyName,
55 int propertyCount,
56 const char** propertyKeys,
57 const char** propertyValues,
58 void** hostHandle,
59 unsigned int* domainId);
60
61//
62// Shutdown CoreCLR. It unloads the app domain and stops the CoreCLR host.
63//
64// Parameters:
65// hostHandle - Handle of the host
66// domainId - Id of the domain
67//
68// Returns:
69// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed
70//
71CORECLR_HOSTING_API(coreclr_shutdown,
72 void* hostHandle,
73 unsigned int domainId);
74
75//
76// Shutdown CoreCLR. It unloads the app domain and stops the CoreCLR host.
77//
78// Parameters:
79// hostHandle - Handle of the host
80// domainId - Id of the domain
81// latchedExitCode - Latched exit code after domain unloaded
82//
83// Returns:
84// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed
85//
86CORECLR_HOSTING_API(coreclr_shutdown_2,
87 void* hostHandle,
88 unsigned int domainId,
89 int* latchedExitCode);
90
91//
92// Create a native callable function pointer for a managed method.
93//
94// Parameters:
95// hostHandle - Handle of the host
96// domainId - Id of the domain
97// entryPointAssemblyName - Name of the assembly which holds the custom entry point
98// entryPointTypeName - Name of the type which holds the custom entry point
99// entryPointMethodName - Name of the method which is the custom entry point
100// delegate - Output parameter, the function stores a native callable function pointer to the delegate at the specified address
101//
102// Returns:
103// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed
104//
105CORECLR_HOSTING_API(coreclr_create_delegate,
106 void* hostHandle,
107 unsigned int domainId,
108 const char* entryPointAssemblyName,
109 const char* entryPointTypeName,
110 const char* entryPointMethodName,
111 void** delegate);
112
113//
114// Execute a managed assembly with given arguments
115//
116// Parameters:
117// hostHandle - Handle of the host
118// domainId - Id of the domain
119// argc - Number of arguments passed to the executed assembly
120// argv - Array of arguments passed to the executed assembly
121// managedAssemblyPath - Path of the managed assembly to execute (or NULL if using a custom entrypoint).
122// exitCode - Exit code returned by the executed assembly
123//
124// Returns:
125// HRESULT indicating status of the operation. S_OK if the assembly was successfully executed
126//
127CORECLR_HOSTING_API(coreclr_execute_assembly,
128 void* hostHandle,
129 unsigned int domainId,
130 int argc,
131 const char** argv,
132 const char* managedAssemblyPath,
133 unsigned int* exitCode);
134
135#undef CORECLR_HOSTING_API
136
137#endif // __CORECLR_HOST_H__ \ No newline at end of file
diff --git a/src/dnchost/dnchost.cpp b/src/dnchost/dnchost.cpp
new file mode 100644
index 00000000..c4b0d222
--- /dev/null
+++ b/src/dnchost/dnchost.cpp
@@ -0,0 +1,229 @@
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
5static DNCSTATE vstate = { };
6
7
8// internal function declarations
9
10static HRESULT LoadModulePaths(
11 __in DNCSTATE* pState
12 );
13static HRESULT LoadDncConfiguration(
14 __in DNCSTATE* pState,
15 __in const BOOTSTRAPPER_CREATE_ARGS* pArgs
16 );
17static HRESULT LoadRuntime(
18 __in DNCSTATE* pState
19 );
20static HRESULT LoadManagedBootstrapperApplicationFactory(
21 __in DNCSTATE* pState
22 );
23
24
25// function definitions
26
27extern "C" BOOL WINAPI DllMain(
28 IN HINSTANCE hInstance,
29 IN DWORD dwReason,
30 IN LPVOID /* pvReserved */
31 )
32{
33 switch (dwReason)
34 {
35 case DLL_PROCESS_ATTACH:
36 ::DisableThreadLibraryCalls(hInstance);
37 vstate.hInstance = hInstance;
38 break;
39
40 case DLL_PROCESS_DETACH:
41 vstate.hInstance = NULL;
42 break;
43 }
44
45 return TRUE;
46}
47
48extern "C" HRESULT WINAPI BootstrapperApplicationCreate(
49 __in const BOOTSTRAPPER_CREATE_ARGS* pArgs,
50 __inout BOOTSTRAPPER_CREATE_RESULTS* pResults
51 )
52{
53 HRESULT hr = S_OK;
54 IBootstrapperEngine* pEngine = NULL;
55
56 // coreclr.dll doesn't support unloading, so the rest of the .NET Core hosting stack doesn't support it either.
57 // This means we also can't unload.
58 pResults->fDisableUnloading = TRUE;
59
60 hr = BalInitializeFromCreateArgs(pArgs, &pEngine);
61 ExitOnFailure(hr, "Failed to initialize Bal.");
62
63 if (!vstate.fInitialized)
64 {
65 hr = XmlInitialize();
66 BalExitOnFailure(hr, "Failed to initialize XML.");
67
68 hr = LoadModulePaths(&vstate);
69 BalExitOnFailure(hr, "Failed to get the host base path.");
70
71 hr = LoadDncConfiguration(&vstate, pArgs);
72 BalExitOnFailure(hr, "Failed to get the dnc configuration.");
73
74 vstate.fInitialized = TRUE;
75 }
76
77 if (!vstate.fInitializedRuntime)
78 {
79 hr = LoadRuntime(&vstate);
80 BalExitOnFailure(hr, "Failed to load .NET Core runtime.");
81
82 vstate.fInitializedRuntime = TRUE;
83
84 hr = LoadManagedBootstrapperApplicationFactory(&vstate);
85 BalExitOnFailure(hr, "Failed to create the .NET Core bootstrapper application factory.");
86 }
87
88 BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading .NET Core SCD bootstrapper application.");
89
90 hr = vstate.pAppFactory->Create(pArgs, pResults);
91 BalExitOnFailure(hr, "Failed to create the .NET Core bootstrapper application.");
92
93LExit:
94 ReleaseNullObject(pEngine);
95
96 return hr;
97}
98
99extern "C" void WINAPI BootstrapperApplicationDestroy()
100{
101 BalUninitialize();
102}
103
104static HRESULT LoadModulePaths(
105 __in DNCSTATE* pState
106 )
107{
108 HRESULT hr = S_OK;
109
110 hr = PathForCurrentProcess(&pState->sczModuleFullPath, pState->hInstance);
111 BalExitOnFailure(hr, "Failed to get the full host path.");
112
113 hr = PathGetDirectory(pState->sczModuleFullPath, &pState->sczAppBase);
114 BalExitOnFailure(hr, "Failed to get the directory of the full process path.");
115
116 hr = PathConcat(pState->sczAppBase, DNC_ASSEMBLY_FILE_NAME, &pState->sczManagedHostPath);
117 BalExitOnFailure(hr, "Failed to create managed host path.");
118
119LExit:
120 return hr;
121}
122
123static HRESULT LoadDncConfiguration(
124 __in DNCSTATE* pState,
125 __in const BOOTSTRAPPER_CREATE_ARGS* pArgs
126 )
127{
128 HRESULT hr = S_OK;
129 IXMLDOMDocument* pixdManifest = NULL;
130 IXMLDOMNode* pixnHost = NULL;
131 IXMLDOMNode* pixnPayload = NULL;
132 LPWSTR sczPayloadId = NULL;
133 LPWSTR sczPayloadXPath = NULL;
134 LPWSTR sczPayloadName = NULL;
135
136 hr = XmlLoadDocumentFromFile(pArgs->pCommand->wzBootstrapperApplicationDataPath, &pixdManifest);
137 BalExitOnFailure(hr, "Failed to load BalManifest '%ls'", pArgs->pCommand->wzBootstrapperApplicationDataPath);
138
139 hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixBalBAFactoryAssembly", &pixnHost);
140 BalExitOnFailure(hr, "Failed to get WixBalBAFactoryAssembly element.");
141
142 if (S_FALSE == hr)
143 {
144 hr = E_NOTFOUND;
145 BalExitOnRootFailure(hr, "Failed to find WixBalBAFactoryAssembly element in bootstrapper application config.");
146 }
147
148 hr = XmlGetAttributeEx(pixnHost, L"PayloadId", &sczPayloadId);
149 BalExitOnFailure(hr, "Failed to get WixBalBAFactoryAssembly/@PayloadId.");
150
151 hr = StrAllocFormatted(&sczPayloadXPath, L"/BootstrapperApplicationData/WixPayloadProperties[@Payload='%ls']", sczPayloadId);
152 BalExitOnFailure(hr, "Failed to format BAFactoryAssembly payload XPath.");
153
154 hr = XmlSelectSingleNode(pixdManifest, sczPayloadXPath, &pixnPayload);
155 if (S_FALSE == hr)
156 {
157 hr = E_NOTFOUND;
158 }
159 BalExitOnFailure(hr, "Failed to find WixPayloadProperties node for BAFactoryAssembly PayloadId: %ls.", sczPayloadId);
160
161 hr = XmlGetAttributeEx(pixnPayload, L"Name", &sczPayloadName);
162 BalExitOnFailure(hr, "Failed to get BAFactoryAssembly payload Name.");
163
164 hr = PathConcat(pArgs->pCommand->wzBootstrapperWorkingFolder, sczPayloadName, &pState->sczBaFactoryAssemblyPath);
165 BalExitOnFailure(hr, "Failed to create BaFactoryAssemblyPath.");
166
167 LPCWSTR wzFileName = PathFile(pState->sczBaFactoryAssemblyPath);
168 LPCWSTR wzExtension = PathExtension(pState->sczBaFactoryAssemblyPath);
169 if (!wzExtension)
170 {
171 BalExitOnFailure(hr = E_FAIL, "BaFactoryAssemblyPath has no extension.");
172 }
173
174 hr = StrAllocString(&pState->sczBaFactoryAssemblyName, wzFileName, wzExtension - wzFileName);
175 BalExitOnFailure(hr, "Failed to copy BAFactoryAssembly payload Name.");
176
177 hr = StrAllocString(&pState->sczBaFactoryDepsJsonPath, pState->sczBaFactoryAssemblyPath, wzExtension - pState->sczBaFactoryAssemblyPath);
178 BalExitOnFailure(hr, "Failed to initialize deps json path.");
179
180 hr = StrAllocString(&pState->sczBaFactoryRuntimeConfigPath, pState->sczBaFactoryDepsJsonPath, 0);
181 BalExitOnFailure(hr, "Failed to initialize runtime config path.");
182
183 hr = StrAllocConcat(&pState->sczBaFactoryDepsJsonPath, L".deps.json", 0);
184 BalExitOnFailure(hr, "Failed to concat extension to deps json path.");
185
186 hr = StrAllocConcat(&pState->sczBaFactoryRuntimeConfigPath, L".runtimeconfig.json", 0);
187 BalExitOnFailure(hr, "Failed to concat extension to runtime config path.");
188
189LExit:
190 ReleaseStr(sczPayloadName);
191 ReleaseObject(pixnPayload);
192 ReleaseStr(sczPayloadXPath);
193 ReleaseStr(sczPayloadId);
194 ReleaseObject(pixnHost);
195 ReleaseObject(pixdManifest);
196
197 return hr;
198}
199
200static HRESULT LoadRuntime(
201 __in DNCSTATE* pState
202 )
203{
204 HRESULT hr = S_OK;
205
206 hr = DnchostLoadRuntime(
207 &pState->hostfxrState,
208 pState->sczModuleFullPath,
209 pState->sczManagedHostPath,
210 pState->sczBaFactoryDepsJsonPath,
211 pState->sczBaFactoryRuntimeConfigPath);
212
213 return hr;
214}
215
216static HRESULT LoadManagedBootstrapperApplicationFactory(
217 __in DNCSTATE* pState
218 )
219{
220 HRESULT hr = S_OK;
221
222 hr = DnchostCreateFactory(
223 &pState->hostfxrState,
224 pState->sczBaFactoryAssemblyName,
225 pState->sczBaFactoryAssemblyPath,
226 &pState->pAppFactory);
227
228 return hr;
229}
diff --git a/src/dnchost/dnchost.def b/src/dnchost/dnchost.def
new file mode 100644
index 00000000..4488df94
--- /dev/null
+++ b/src/dnchost/dnchost.def
@@ -0,0 +1,6 @@
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
4EXPORTS
5 BootstrapperApplicationCreate
6 BootstrapperApplicationDestroy
diff --git a/src/dnchost/dnchost.h b/src/dnchost/dnchost.h
new file mode 100644
index 00000000..e498edaf
--- /dev/null
+++ b/src/dnchost/dnchost.h
@@ -0,0 +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
5struct DNCSTATE
6{
7 BOOL fInitialized;
8 BOOL fInitializedRuntime;
9 HINSTANCE hInstance;
10 LPWSTR sczModuleFullPath;
11 LPWSTR sczAppBase;
12 LPWSTR sczManagedHostPath;
13 LPWSTR sczBaFactoryAssemblyName;
14 LPWSTR sczBaFactoryAssemblyPath;
15 LPWSTR sczBaFactoryDepsJsonPath;
16 LPWSTR sczBaFactoryRuntimeConfigPath;
17 HOSTFXR_STATE hostfxrState;
18 IBootstrapperApplicationFactory* pAppFactory;
19};
diff --git a/src/dnchost/dnchost.vcxproj b/src/dnchost/dnchost.vcxproj
new file mode 100644
index 00000000..e2b8b529
--- /dev/null
+++ b/src/dnchost/dnchost.vcxproj
@@ -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<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
4 <Import Project="..\..\packages\WixToolset.BalUtil.4.0.19\build\WixToolset.BalUtil.props" Condition="Exists('..\..\packages\WixToolset.BalUtil.4.0.19\build\WixToolset.BalUtil.props')" />
5 <Import Project="..\..\packages\WixToolset.BootstrapperCore.Native.4.0.15\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.15\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 </ItemGroup>
17 <PropertyGroup Label="Globals">
18 <ProjectGuid>{B6F70281-6583-4138-BB7F-AABFEBBB3CA2}</ProjectGuid>
19 <ConfigurationType>DynamicLibrary</ConfigurationType>
20 <PlatformToolset>v141</PlatformToolset>
21 <CharacterSet>Unicode</CharacterSet>
22 <TargetName>dnchost</TargetName>
23 <ProjectModuleDefinitionFile>dnchost.def</ProjectModuleDefinitionFile>
24 </PropertyGroup>
25 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
26 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
27 <PropertyGroup>
28 <NetHostPath>..\..\packages\runtime.win-x86.Microsoft.NETCore.DotNetAppHost.3.1.3\runtimes\win-x86\native\</NetHostPath>
29 <ProjectAdditionalLinkLibraries>shlwapi.lib;$(NetHostPath)nethost.lib</ProjectAdditionalLinkLibraries>
30 </PropertyGroup>
31 <ItemGroup>
32 <ClCompile Include="dnchost.cpp" />
33 <ClCompile Include="dncutil.cpp" />
34 <ClCompile Include="precomp.cpp">
35 <PrecompiledHeader>Create</PrecompiledHeader>
36 </ClCompile>
37 </ItemGroup>
38 <ItemGroup>
39 <ClInclude Include="coreclrhost.h" />
40 <ClInclude Include="dnchost.h" />
41 <ClInclude Include="dncutil.h" />
42 <ClInclude Include="hostfxr.h" />
43 <ClInclude Include="precomp.h" />
44 </ItemGroup>
45 <ItemGroup>
46 <None Include="dnchost.def" />
47 </ItemGroup>
48 <ItemGroup>
49 <None Include="packages.config" />
50 <Content Include="$(NetHostPath)nethost.dll">
51 <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
52 <Visible>False</Visible>
53 </Content>
54 </ItemGroup>
55 <ItemDefinitionGroup>
56 <ClCompile>
57 <AdditionalIncludeDirectories>$(BaseOutputPath)obj;$(NetHostPath);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
58 </ClCompile>
59 </ItemDefinitionGroup>
60 <ItemGroup>
61 <ProjectReference Include="..\WixToolset.Dnc.Host\WixToolset.Dnc.Host.csproj">
62 <Project>{0D780900-C2FF-4FA2-8CB5-8A19768724C5}</Project>
63 <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
64 </ProjectReference>
65 </ItemGroup>
66 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
67 <Import Project="..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" />
68 <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
69 <PropertyGroup>
70 <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>
71 </PropertyGroup>
72 <Error Condition="!Exists('..\..\packages\WixToolset.BalUtil.4.0.19\build\WixToolset.BalUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.BalUtil.4.0.19\build\WixToolset.BalUtil.props'))" />
73 <Error Condition="!Exists('..\..\packages\WixToolset.BootstrapperCore.Native.4.0.15\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\WixToolset.BootstrapperCore.Native.4.0.15\build\WixToolset.BootstrapperCore.Native.props'))" />
74 <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'))" />
75 <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'))" />
76 </Target>
77</Project> \ No newline at end of file
diff --git a/src/dnchost/dncutil.cpp b/src/dnchost/dncutil.cpp
new file mode 100644
index 00000000..996bf086
--- /dev/null
+++ b/src/dnchost/dncutil.cpp
@@ -0,0 +1,359 @@
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// https://github.com/dotnet/runtime/blob/master/src/installer/corehost/error_codes.h
6#define HostApiBufferTooSmall 0x80008098
7
8// internal function declarations
9
10static HRESULT GetHostfxrPath(
11 __in HOSTFXR_STATE* pState,
12 __in LPCWSTR wzNativeHostPath
13 );
14static HRESULT LoadHostfxr(
15 __in HOSTFXR_STATE* pState
16 );
17static HRESULT InitializeHostfxr(
18 __in HOSTFXR_STATE* pState,
19 __in LPCWSTR wzManagedHostPath,
20 __in LPCWSTR wzDepsJsonPath,
21 __in LPCWSTR wzRuntimeConfigPath
22 );
23static HRESULT InitializeCoreClr(
24 __in HOSTFXR_STATE* pState,
25 __in LPCWSTR wzNativeHostPath
26 );
27static HRESULT LoadCoreClr(
28 __in HOSTFXR_STATE* pState,
29 __in LPCWSTR wzCoreClrPath
30 );
31static HRESULT StartCoreClr(
32 __in HOSTFXR_STATE* pState,
33 __in LPCWSTR wzNativeHostPath,
34 __in size_t cProperties,
35 __in LPCWSTR* propertyKeys,
36 __in LPCWSTR* propertyValues
37 );
38
39
40// function definitions
41
42HRESULT DnchostLoadRuntime(
43 __in HOSTFXR_STATE* pState,
44 __in LPCWSTR wzNativeHostPath,
45 __in LPCWSTR wzManagedHostPath,
46 __in LPCWSTR wzDepsJsonPath,
47 __in LPCWSTR wzRuntimeConfigPath
48 )
49{
50 HRESULT hr = S_OK;
51
52 hr = GetHostfxrPath(pState, wzNativeHostPath);
53 BalExitOnFailure(hr, "Failed to find hostfxr.");
54
55 hr = LoadHostfxr(pState);
56 BalExitOnFailure(hr, "Failed to load hostfxr.");
57
58 hr = InitializeHostfxr(pState, wzManagedHostPath, wzDepsJsonPath, wzRuntimeConfigPath);
59 BalExitOnFailure(hr, "Failed to initialize hostfxr.");
60
61 hr = InitializeCoreClr(pState, wzNativeHostPath);
62 BalExitOnFailure(hr, "Failed to initialize coreclr.");
63
64LExit:
65 return hr;
66}
67
68HRESULT DnchostCreateFactory(
69 __in HOSTFXR_STATE* pState,
70 __in LPCWSTR wzBaFactoryAssemblyName,
71 __in LPCWSTR wzBaFactoryAssemblyPath,
72 __out IBootstrapperApplicationFactory** ppAppFactory
73 )
74{
75 HRESULT hr = S_OK;
76 PFNCREATEBAFACTORY pfnCreateBAFactory = NULL;
77
78 hr = pState->pfnCoreclrCreateDelegate(
79 pState->pClrHandle,
80 pState->dwDomainId,
81 DNC_ASSEMBLY_FULL_NAME,
82 DNC_ENTRY_TYPE,
83 DNC_STATIC_ENTRY_METHOD,
84 reinterpret_cast<void**>(&pfnCreateBAFactory));
85 BalExitOnFailure(hr, "Failed to create delegate in app domain.");
86
87 *ppAppFactory = pfnCreateBAFactory(wzBaFactoryAssemblyName, wzBaFactoryAssemblyPath);
88
89LExit:
90 return hr;
91}
92
93static HRESULT GetHostfxrPath(
94 __in HOSTFXR_STATE* pState,
95 __in LPCWSTR wzNativeHostPath
96 )
97{
98 HRESULT hr = S_OK;
99 get_hostfxr_parameters getHostfxrParameters = { };
100 int nrc = 0;
101 size_t cchHostFxrPath = MAX_PATH;
102
103 getHostfxrParameters.size = sizeof(get_hostfxr_parameters);
104 getHostfxrParameters.assembly_path = wzNativeHostPath;
105
106 // get_hostfxr_path does a full search on every call, so
107 // minimize the number of calls
108 // need to loop
109 for (;;)
110 {
111 cchHostFxrPath *= 2;
112 hr = StrAlloc(&pState->sczHostfxrPath, cchHostFxrPath);
113 BalExitOnFailure(hr, "Failed to allocate hostFxrPath.");
114
115 nrc = get_hostfxr_path(pState->sczHostfxrPath, &cchHostFxrPath, &getHostfxrParameters);
116 if (HostApiBufferTooSmall != nrc)
117 {
118 break;
119 }
120 }
121 if (0 != nrc)
122 {
123 BalExitOnFailure(hr = nrc, "GetHostfxrPath failed");
124 }
125
126LExit:
127 return hr;
128}
129
130static HRESULT LoadHostfxr(
131 __in HOSTFXR_STATE* pState
132 )
133{
134 HRESULT hr = S_OK;
135 HMODULE hHostfxr;
136
137 hHostfxr = ::LoadLibraryExW(pState->sczHostfxrPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
138 BalExitOnNullWithLastError(hHostfxr, hr, "Failed to load hostfxr from '%ls'.", pState->sczHostfxrPath);
139
140 pState->pfnHostfxrInitializeForApp = reinterpret_cast<hostfxr_initialize_for_dotnet_command_line_fn>(::GetProcAddress(hHostfxr, "hostfxr_initialize_for_dotnet_command_line"));
141 BalExitOnNullWithLastError(pState->pfnHostfxrInitializeForApp, hr, "Failed to get procedure address for hostfxr_initialize_for_dotnet_command_line.");
142
143 pState->pfnHostfxrGetRuntimeProperties = reinterpret_cast<hostfxr_get_runtime_properties_fn>(::GetProcAddress(hHostfxr, "hostfxr_get_runtime_properties"));
144 BalExitOnNullWithLastError(pState->pfnHostfxrGetRuntimeProperties, hr, "Failed to get procedure address for hostfxr_get_runtime_properties.");
145
146 pState->pfnHostfxrSetErrorWriter = reinterpret_cast<hostfxr_set_error_writer_fn>(::GetProcAddress(hHostfxr, "hostfxr_set_error_writer"));
147 BalExitOnNullWithLastError(pState->pfnHostfxrSetErrorWriter, hr, "Failed to get procedure address for hostfxr_set_error_writer.");
148
149 pState->pfnHostfxrClose = reinterpret_cast<hostfxr_close_fn>(::GetProcAddress(hHostfxr, "hostfxr_close"));
150 BalExitOnNullWithLastError(pState->pfnHostfxrClose, hr, "Failed to get procedure address for hostfxr_close.");
151
152LExit:
153 // Never unload the module since it isn't meant to be unloaded.
154
155 return hr;
156}
157
158static void HOSTFXR_CALLTYPE DnchostErrorWriter(
159 __in LPCWSTR wzMessage
160 )
161{
162 BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "error from hostfxr: %ls", wzMessage);
163}
164
165static HRESULT InitializeHostfxr(
166 __in HOSTFXR_STATE* pState,
167 __in LPCWSTR wzManagedHostPath,
168 __in LPCWSTR wzDepsJsonPath,
169 __in LPCWSTR wzRuntimeConfigPath
170 )
171{
172 HRESULT hr = S_OK;
173
174 pState->pfnHostfxrSetErrorWriter(static_cast<hostfxr_error_writer_fn>(&DnchostErrorWriter));
175
176 LPCWSTR argv[] = {
177 L"exec",
178 L"--depsfile",
179 wzDepsJsonPath,
180 L"--runtimeconfig",
181 wzRuntimeConfigPath,
182 wzManagedHostPath,
183 };
184 hr = pState->pfnHostfxrInitializeForApp(sizeof(argv)/sizeof(LPWSTR), argv, NULL, &pState->hostContextHandle);
185 BalExitOnFailure(hr, "HostfxrInitializeForApp failed");
186
187LExit:
188 return hr;
189}
190
191static HRESULT InitializeCoreClr(
192 __in HOSTFXR_STATE* pState,
193 __in LPCWSTR wzNativeHostPath
194 )
195{
196 HRESULT hr = S_OK;
197 int32_t rc = 0;
198 LPCWSTR* rgPropertyKeys = NULL;
199 LPCWSTR* rgPropertyValues = NULL;
200 size_t cProperties = 0;
201 LPWSTR* rgDirectories = NULL;
202 UINT cDirectories = 0;
203 LPWSTR sczCoreClrPath = NULL;
204
205 // We are not using hostfxr as it was intended to be used. We need to initialize hostfxr so that it properly initializes hostpolicy -
206 // there are pieces of the framework such as AssemblyDependencyResolver that won't work without that. We also need hostfxr to find a
207 // compatible framework for framework-dependent deployed BAs. We had to use hostfxr_initialize_for_dotnet_command_line since
208 // hostfxr_initialize_for_runtime_config doesn't currently (3.x) support self-contained deployed BAs. That means we're supposed to
209 // start the runtime through hostfxr_run_app, but that method shuts down the runtime before returning. We actually want to call
210 // hostfxr_get_runtime_delegate, but that method currently requires hostfxr to be initialized through
211 // hostfxr_initialize_for_runtime_config. So we're forced to locate coreclr.dll and manually load the runtime ourselves.
212
213 // Unfortunately, that's not the only problem. hostfxr has global state that tracks whether it started the runtime. While we keep our
214 // hostfxr_handle open, everyone that calls the hostfxr_initialize_* methods will block until we have started the runtime through
215 // hostfxr or closed our handle. If we close the handle, then hostfxr could potentially try to load a second runtime into the
216 // process, which is not supported. We're going to just keep our handle open since no one else in the process should be trying to
217 // start the runtime anyway.
218
219 rc = pState->pfnHostfxrGetRuntimeProperties(pState->hostContextHandle, &cProperties, rgPropertyKeys, rgPropertyValues);
220 if (HostApiBufferTooSmall != rc)
221 {
222 BalExitOnFailure(hr = rc, "HostfxrGetRuntimeProperties failed to return required size.");
223 }
224
225 rgPropertyKeys = static_cast<LPCWSTR*>(MemAlloc(sizeof(LPWSTR) * cProperties, TRUE));
226 rgPropertyValues = static_cast<LPCWSTR*>(MemAlloc(sizeof(LPWSTR) * cProperties, TRUE));
227 if (!rgPropertyKeys || !rgPropertyValues)
228 {
229 BalExitOnFailure(hr = E_OUTOFMEMORY, "Failed to allocate buffers for runtime properties.");
230 }
231
232 hr = pState->pfnHostfxrGetRuntimeProperties(pState->hostContextHandle, &cProperties, rgPropertyKeys, rgPropertyValues);
233 BalExitOnFailure(hr, "HostfxrGetRuntimeProperties failed.");
234
235 for (DWORD i = 0; i < cProperties; ++i)
236 {
237 if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, 0, rgPropertyKeys[i], -1, L"NATIVE_DLL_SEARCH_DIRECTORIES", -1))
238 {
239 hr = StrSplitAllocArray(&rgDirectories, &cDirectories, rgPropertyValues[i], L";");
240 BalExitOnFailure(hr, "Failed to split NATIVE_DLL_SEARCH_DIRECTORIES '%ls'", rgPropertyValues[i]);
241 }
242 }
243
244 for (DWORD i = 0; i < cDirectories; ++i)
245 {
246 hr = PathConcat(rgDirectories[i], L"coreclr.dll", &sczCoreClrPath);
247 BalExitOnFailure(hr, "Failed to allocate path to coreclr.");
248
249 if (::PathFileExists(sczCoreClrPath))
250 {
251 break;
252 }
253 else
254 {
255 ReleaseNullStr(sczCoreClrPath);
256 }
257 }
258
259 if (!sczCoreClrPath)
260 {
261 for (DWORD i = 0; i < cProperties; ++i)
262 {
263 BalLog(BOOTSTRAPPER_LOG_LEVEL_ERROR, "%ls: %ls", rgPropertyKeys[i], rgPropertyValues[i]);
264 }
265 BalExitOnFailure(hr = E_FILENOTFOUND, "Failed to locate coreclr.dll.");
266 }
267
268 hr = LoadCoreClr(pState, sczCoreClrPath);
269 BalExitOnFailure(hr, "Failed to load coreclr.");
270
271 hr = StartCoreClr(pState, wzNativeHostPath, cProperties, rgPropertyKeys, rgPropertyValues);
272 BalExitOnFailure(hr, "Failed to start coreclr.");
273
274LExit:
275 MemFree(rgDirectories);
276 MemFree(rgPropertyValues);
277 MemFree(rgPropertyKeys);
278 ReleaseStr(sczCoreClrPath);
279
280 return hr;
281}
282
283static HRESULT LoadCoreClr(
284 __in HOSTFXR_STATE* pState,
285 __in LPCWSTR wzCoreClrPath
286 )
287{
288 HRESULT hr = S_OK;
289 HMODULE hModule = NULL;
290
291 hModule = ::LoadLibraryExW(wzCoreClrPath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH);
292 BalExitOnNullWithLastError(hModule, hr, "Failed to load coreclr.dll from '%ls'.", wzCoreClrPath);
293
294 pState->pfnCoreclrInitialize = reinterpret_cast<coreclr_initialize_ptr>(::GetProcAddress(hModule, "coreclr_initialize"));
295 BalExitOnNullWithLastError(pState->pfnCoreclrInitialize, hr, "Failed to get procedure address for coreclr_initialize.");
296
297 pState->pfnCoreclrCreateDelegate = reinterpret_cast<coreclr_create_delegate_ptr>(::GetProcAddress(hModule, "coreclr_create_delegate"));
298 BalExitOnNullWithLastError(pState->pfnCoreclrCreateDelegate, hr, "Failed to get procedure address for coreclr_create_delegate.");
299
300LExit:
301 // Never unload the module since coreclr doesn't support it.
302
303 return hr;
304}
305
306static HRESULT StartCoreClr(
307 __in HOSTFXR_STATE* pState,
308 __in LPCWSTR wzNativeHostPath,
309 __in size_t cProperties,
310 __in LPCWSTR* propertyKeys,
311 __in LPCWSTR* propertyValues
312 )
313{
314 HRESULT hr = S_OK;
315 LPSTR szNativeHostPath = NULL;
316 LPSTR* rgPropertyKeys = NULL;
317 LPSTR* rgPropertyValues = NULL;
318
319 rgPropertyKeys = static_cast<LPSTR*>(MemAlloc(sizeof(LPSTR) * cProperties, TRUE));
320 rgPropertyValues = static_cast<LPSTR*>(MemAlloc(sizeof(LPSTR) * cProperties, TRUE));
321 if (!rgPropertyKeys || !rgPropertyValues)
322 {
323 BalExitOnFailure(hr = E_OUTOFMEMORY, "Failed to allocate buffers for runtime properties.");
324 }
325
326 hr = StrAnsiAllocString(&szNativeHostPath, wzNativeHostPath, 0, CP_UTF8);
327 BalExitOnFailure(hr, "Failed to convert module path to UTF8: %ls", wzNativeHostPath);
328
329 for (DWORD i = 0; i < cProperties; ++i)
330 {
331 hr = StrAnsiAllocString(&rgPropertyKeys[i], propertyKeys[i], 0, CP_UTF8);
332 BalExitOnFailure(hr, "Failed to convert property key to UTF8: %ls", propertyKeys[i]);
333
334 hr = StrAnsiAllocString(&rgPropertyValues[i], propertyValues[i], 0, CP_UTF8);
335 BalExitOnFailure(hr, "Failed to convert property value to UTF8: %ls", propertyValues[i]);
336 }
337
338 hr = pState->pfnCoreclrInitialize(szNativeHostPath, "MBA", cProperties, (LPCSTR*)rgPropertyKeys, (LPCSTR*)rgPropertyValues, &pState->pClrHandle, &pState->dwDomainId);
339 BalExitOnFailure(hr, "CoreclrInitialize failed.");
340
341LExit:
342 for (DWORD i = 0; i < cProperties; ++i)
343 {
344 if (rgPropertyKeys)
345 {
346 ReleaseStr(rgPropertyKeys[i]);
347 }
348
349 if (rgPropertyValues)
350 {
351 ReleaseStr(rgPropertyValues[i]);
352 }
353 }
354 ReleaseMem(rgPropertyValues);
355 ReleaseMem(rgPropertyKeys);
356 ReleaseStr(szNativeHostPath);
357
358 return hr;
359}
diff --git a/src/dnchost/dncutil.h b/src/dnchost/dncutil.h
new file mode 100644
index 00000000..1a7c16e3
--- /dev/null
+++ b/src/dnchost/dncutil.h
@@ -0,0 +1,36 @@
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
4typedef IBootstrapperApplicationFactory* (STDMETHODCALLTYPE* PFNCREATEBAFACTORY)(
5 __in LPCWSTR wzBaFactoryAssemblyName,
6 __in LPCWSTR wzBaFactoryAssemblyPath
7 );
8
9struct HOSTFXR_STATE
10{
11 LPWSTR sczHostfxrPath;
12 hostfxr_handle hostContextHandle;
13 hostfxr_initialize_for_dotnet_command_line_fn pfnHostfxrInitializeForApp;
14 hostfxr_get_runtime_properties_fn pfnHostfxrGetRuntimeProperties;
15 hostfxr_set_error_writer_fn pfnHostfxrSetErrorWriter;
16 hostfxr_close_fn pfnHostfxrClose;
17 coreclr_initialize_ptr pfnCoreclrInitialize;
18 coreclr_create_delegate_ptr pfnCoreclrCreateDelegate;
19 void* pClrHandle;
20 UINT dwDomainId;
21};
22
23HRESULT DnchostLoadRuntime(
24 __in HOSTFXR_STATE* pState,
25 __in LPCWSTR wzNativeHostPath,
26 __in LPCWSTR wzManagedHostPath,
27 __in LPCWSTR wzDepsJsonPath,
28 __in LPCWSTR wzRuntimeConfigPath
29 );
30
31HRESULT DnchostCreateFactory(
32 __in HOSTFXR_STATE* pState,
33 __in LPCWSTR wzBaFactoryAssemblyName,
34 __in LPCWSTR wzBaFactoryAssemblyPath,
35 __out IBootstrapperApplicationFactory** ppAppFactory
36 );
diff --git a/src/dnchost/hostfxr.h b/src/dnchost/hostfxr.h
new file mode 100644
index 00000000..85e6e0ab
--- /dev/null
+++ b/src/dnchost/hostfxr.h
@@ -0,0 +1,96 @@
1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5
6
7// ***** ABOUT THIS HEADER *****
8// **************************************************************************************
9//
10// This is the version on 2019-12-22 from
11// https://github.com/dotnet/runtime/blob/master/src/installer/corehost/cli/hostfxr.h
12//
13// **************************************************************************************
14// ****************************
15
16
17#ifndef __HOSTFXR_H__
18#define __HOSTFXR_H__
19
20#include <stddef.h>
21#include <stdint.h>
22
23#if defined(_WIN32)
24 #define HOSTFXR_CALLTYPE __cdecl
25 #ifdef _WCHAR_T_DEFINED
26 typedef wchar_t char_t;
27 #else
28 typedef unsigned short char_t;
29 #endif
30#else
31 #define HOSTFXR_CALLTYPE
32 typedef char char_t;
33#endif
34
35enum hostfxr_delegate_type
36{
37 hdt_com_activation,
38 hdt_load_in_memory_assembly,
39 hdt_winrt_activation,
40 hdt_com_register,
41 hdt_com_unregister,
42 hdt_load_assembly_and_get_function_pointer
43};
44
45typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_main_fn)(const int argc, const char_t **argv);
46typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_main_startupinfo_fn)(
47 const int argc,
48 const char_t **argv,
49 const char_t *host_path,
50 const char_t *dotnet_root,
51 const char_t *app_path);
52
53typedef void(HOSTFXR_CALLTYPE *hostfxr_error_writer_fn)(const char_t *message);
54typedef hostfxr_error_writer_fn(HOSTFXR_CALLTYPE *hostfxr_set_error_writer_fn)(hostfxr_error_writer_fn error_writer);
55
56typedef void* hostfxr_handle;
57struct hostfxr_initialize_parameters
58{
59 size_t size;
60 const char_t *host_path;
61 const char_t *dotnet_root;
62};
63
64typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_initialize_for_dotnet_command_line_fn)(
65 int argc,
66 const char_t **argv,
67 const struct hostfxr_initialize_parameters *parameters,
68 /*out*/ hostfxr_handle *host_context_handle);
69typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_initialize_for_runtime_config_fn)(
70 const char_t *runtime_config_path,
71 const struct hostfxr_initialize_parameters *parameters,
72 /*out*/ hostfxr_handle *host_context_handle);
73
74typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_get_runtime_property_value_fn)(
75 const hostfxr_handle host_context_handle,
76 const char_t *name,
77 /*out*/ const char_t **value);
78typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_set_runtime_property_value_fn)(
79 const hostfxr_handle host_context_handle,
80 const char_t *name,
81 const char_t *value);
82typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_get_runtime_properties_fn)(
83 const hostfxr_handle host_context_handle,
84 /*inout*/ size_t * count,
85 /*out*/ const char_t **keys,
86 /*out*/ const char_t **values);
87
88typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_run_app_fn)(const hostfxr_handle host_context_handle);
89typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_get_runtime_delegate_fn)(
90 const hostfxr_handle host_context_handle,
91 enum hostfxr_delegate_type type,
92 /*out*/ void **delegate);
93
94typedef int32_t(HOSTFXR_CALLTYPE *hostfxr_close_fn)(const hostfxr_handle host_context_handle);
95
96#endif //__HOSTFXR_H__ \ No newline at end of file
diff --git a/src/dnchost/packages.config b/src/dnchost/packages.config
new file mode 100644
index 00000000..c8911ea5
--- /dev/null
+++ b/src/dnchost/packages.config
@@ -0,0 +1,8 @@
1<?xml version="1.0" encoding="utf-8"?>
2<packages>
3 <package id="runtime.win-x86.Microsoft.NETCore.DotNetAppHost" version="3.1.3" targetFramework="native" />
4 <package id="Nerdbank.GitVersioning" version="2.1.65" targetFramework="native" developmentDependency="true" />
5 <package id="WixToolset.BootstrapperCore.Native" version="4.0.15" targetFramework="native" />
6 <package id="WixToolset.BalUtil" version="4.0.19" targetFramework="native" />
7 <package id="WixToolset.DUtil" version="4.0.18" targetFramework="native" />
8</packages> \ No newline at end of file
diff --git a/src/dnchost/precomp.cpp b/src/dnchost/precomp.cpp
new file mode 100644
index 00000000..37664a1c
--- /dev/null
+++ b/src/dnchost/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/dnchost/precomp.h b/src/dnchost/precomp.h
new file mode 100644
index 00000000..6a12ef67
--- /dev/null
+++ b/src/dnchost/precomp.h
@@ -0,0 +1,29 @@
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#include <corerror.h>
7#include <Shlwapi.h>
8
9#include <dutil.h>
10#include <memutil.h>
11#include <pathutil.h>
12#include <strutil.h>
13#include <xmlutil.h>
14
15#include <BootstrapperEngine.h>
16#include <BootstrapperApplication.h>
17
18#include <IBootstrapperEngine.h>
19#include <IBootstrapperApplication.h>
20#include <IBootstrapperApplicationFactory.h>
21#include <balutil.h>
22
23#include <WixToolset.Dnc.Host.h>
24#include <nethost.h>
25
26#include "coreclrhost.h"
27#include "hostfxr.h"
28#include "dncutil.h"
29#include "dnchost.h"
diff --git a/src/test/WixToolsetTest.ManagedHost/DncHostFixture.cs b/src/test/WixToolsetTest.ManagedHost/DncHostFixture.cs
new file mode 100644
index 00000000..f5714c67
--- /dev/null
+++ b/src/test/WixToolsetTest.ManagedHost/DncHostFixture.cs
@@ -0,0 +1,232 @@
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
3namespace 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 [Fact]
13 public void CanLoadSCDEarliestCoreMBA()
14 {
15 using (var fs = new DisposableFileSystem())
16 {
17 var baseFolder = fs.GetFolder();
18 var binFolder = Path.Combine(baseFolder, "bin");
19 var bundleFile = Path.Combine(binFolder, "SCDEarliestCoreMBA.exe");
20 var baSourceFolder = TestData.Get(@"..\examples");
21 var bundleSourceFolder = TestData.Get(@"TestData\EarliestCoreMBA");
22 var intermediateFolder = Path.Combine(baseFolder, "obj");
23
24 var compileResult = WixRunner.Execute(new[]
25 {
26 "build",
27 Path.Combine(bundleSourceFolder, "SelfContainedBundle.wxs"),
28 Path.Combine(bundleSourceFolder, "HarvestedSCD.wxs"),
29 "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
30 "-intermediateFolder", intermediateFolder,
31 "-bindpath", baSourceFolder,
32 "-burnStub", TestEngine.BurnStubFile,
33 "-o", bundleFile,
34 });
35 compileResult.AssertSuccess();
36 var testEngine = new TestEngine();
37
38 var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
39 var logMessages = result.Output;
40 Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]);
41 Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]);
42 Assert.Equal("EarliestCoreBA", logMessages[2]);
43 Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]);
44 }
45 }
46
47 [Fact]
48 public void CanLoadTrimmedSCDEarliestCoreMBA()
49 {
50 using (var fs = new DisposableFileSystem())
51 {
52 var baseFolder = fs.GetFolder();
53 var binFolder = Path.Combine(baseFolder, "bin");
54 var bundleFile = Path.Combine(binFolder, "TrimmedSCDEarliestCoreMBA.exe");
55 var baSourceFolder = TestData.Get(@"..\examples");
56 var bundleSourceFolder = TestData.Get(@"TestData\EarliestCoreMBA");
57 var intermediateFolder = Path.Combine(baseFolder, "obj");
58
59 var compileResult = WixRunner.Execute(new[]
60 {
61 "build",
62 Path.Combine(bundleSourceFolder, "TrimmedSelfContainedBundle.wxs"),
63 Path.Combine(bundleSourceFolder, "HarvestedTrimmedSCD.wxs"),
64 "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
65 "-intermediateFolder", intermediateFolder,
66 "-bindpath", baSourceFolder,
67 "-burnStub", TestEngine.BurnStubFile,
68 "-o", bundleFile,
69 });
70 compileResult.AssertSuccess();
71 var testEngine = new TestEngine();
72
73 var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
74 var logMessages = result.Output;
75 Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]);
76 Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]);
77 Assert.Equal("EarliestCoreBA", logMessages[2]);
78 Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]);
79 }
80 }
81
82 [Fact]
83 public void CanReloadSCDEarliestCoreMBA()
84 {
85 using (var fs = new DisposableFileSystem())
86 {
87 var baseFolder = fs.GetFolder();
88 var binFolder = Path.Combine(baseFolder, "bin");
89 var bundleFile = Path.Combine(binFolder, "SCDEarliestCoreMBA.exe");
90 var baSourceFolder = TestData.Get(@"..\examples");
91 var bundleSourceFolder = TestData.Get(@"TestData\EarliestCoreMBA");
92 var intermediateFolder = Path.Combine(baseFolder, "obj");
93
94 var compileResult = WixRunner.Execute(new[]
95 {
96 "build",
97 Path.Combine(bundleSourceFolder, "SelfContainedBundle.wxs"),
98 Path.Combine(bundleSourceFolder, "HarvestedSCD.wxs"),
99 "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
100 "-intermediateFolder", intermediateFolder,
101 "-bindpath", baSourceFolder,
102 "-burnStub", TestEngine.BurnStubFile,
103 "-o", bundleFile,
104 });
105 compileResult.AssertSuccess();
106 var testEngine = new TestEngine();
107
108 var result = testEngine.RunReloadEngine(bundleFile, baseFolder);
109 var logMessages = result.Output;
110 Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]);
111 Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]);
112 Assert.Equal("EarliestCoreBA", logMessages[2]);
113 Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]);
114 Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[4]);
115 Assert.Equal("Reloaded 1 time(s)", logMessages[5]); // dnchost doesn't currently support unloading
116 Assert.Equal("Creating BA thread to run asynchronously.", logMessages[6]);
117 Assert.Equal("EarliestCoreBA", logMessages[7]);
118 Assert.Equal("Shutdown,Restart,0", logMessages[8]);
119 }
120 }
121
122 [Fact]
123 public void CanLoadSCDLatestCoreMBA()
124 {
125 using (var fs = new DisposableFileSystem())
126 {
127 var baseFolder = fs.GetFolder();
128 var binFolder = Path.Combine(baseFolder, "bin");
129 var bundleFile = Path.Combine(binFolder, "SCDLatestCoreMBA.exe");
130 var baSourceFolder = TestData.Get(@"..\examples");
131 var bundleSourceFolder = TestData.Get(@"TestData\LatestCoreMBA");
132 var intermediateFolder = Path.Combine(baseFolder, "obj");
133
134 var compileResult = WixRunner.Execute(new[]
135 {
136 "build",
137 Path.Combine(bundleSourceFolder, "SelfContainedBundle.wxs"),
138 Path.Combine(bundleSourceFolder, "HarvestedSCD.wxs"),
139 "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
140 "-intermediateFolder", intermediateFolder,
141 "-bindpath", baSourceFolder,
142 "-burnStub", TestEngine.BurnStubFile,
143 "-o", bundleFile,
144 });
145 compileResult.AssertSuccess();
146 var testEngine = new TestEngine();
147
148 var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
149 var logMessages = result.Output;
150 Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]);
151 Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]);
152 Assert.Equal("LatestCoreBA", logMessages[2]);
153 Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]);
154 }
155 }
156
157 [Fact]
158 public void CanLoadTrimmedSCDLatestCoreMBA()
159 {
160 using (var fs = new DisposableFileSystem())
161 {
162 var baseFolder = fs.GetFolder();
163 var binFolder = Path.Combine(baseFolder, "bin");
164 var bundleFile = Path.Combine(binFolder, "TrimmedSCDLatestCoreMBA.exe");
165 var baSourceFolder = TestData.Get(@"..\examples");
166 var bundleSourceFolder = TestData.Get(@"TestData\LatestCoreMBA");
167 var intermediateFolder = Path.Combine(baseFolder, "obj");
168
169 var compileResult = WixRunner.Execute(new[]
170 {
171 "build",
172 Path.Combine(bundleSourceFolder, "TrimmedSelfContainedBundle.wxs"),
173 Path.Combine(bundleSourceFolder, "HarvestedTrimmedSCD.wxs"),
174 "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
175 "-intermediateFolder", intermediateFolder,
176 "-bindpath", baSourceFolder,
177 "-burnStub", TestEngine.BurnStubFile,
178 "-o", bundleFile,
179 });
180 compileResult.AssertSuccess();
181 var testEngine = new TestEngine();
182
183 var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
184 var logMessages = result.Output;
185 Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]);
186 Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]);
187 Assert.Equal("LatestCoreBA", logMessages[2]);
188 Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]);
189 }
190 }
191
192 [Fact]
193 public void CanReloadSCDLatestCoreMBA()
194 {
195 using (var fs = new DisposableFileSystem())
196 {
197 var baseFolder = fs.GetFolder();
198 var binFolder = Path.Combine(baseFolder, "bin");
199 var bundleFile = Path.Combine(binFolder, "SCDLatestCoreMBA.exe");
200 var baSourceFolder = TestData.Get(@"..\examples");
201 var bundleSourceFolder = TestData.Get(@"TestData\LatestCoreMBA");
202 var intermediateFolder = Path.Combine(baseFolder, "obj");
203
204 var compileResult = WixRunner.Execute(new[]
205 {
206 "build",
207 Path.Combine(bundleSourceFolder, "SelfContainedBundle.wxs"),
208 Path.Combine(bundleSourceFolder, "HarvestedSCD.wxs"),
209 "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
210 "-intermediateFolder", intermediateFolder,
211 "-bindpath", baSourceFolder,
212 "-burnStub", TestEngine.BurnStubFile,
213 "-o", bundleFile,
214 });
215 compileResult.AssertSuccess();
216 var testEngine = new TestEngine();
217
218 var result = testEngine.RunReloadEngine(bundleFile, baseFolder);
219 var logMessages = result.Output;
220 Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]);
221 Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]);
222 Assert.Equal("LatestCoreBA", logMessages[2]);
223 Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]);
224 Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[4]);
225 Assert.Equal("Reloaded 1 time(s)", logMessages[5]); // dnchost doesn't currently support unloading
226 Assert.Equal("Creating BA thread to run asynchronously.", logMessages[6]);
227 Assert.Equal("LatestCoreBA", logMessages[7]);
228 Assert.Equal("Shutdown,Restart,0", logMessages[8]);
229 }
230 }
231 }
232}
diff --git a/src/test/WixToolsetTest.ManagedHost/HarvestDirectoryToPayloadGroup.ps1 b/src/test/WixToolsetTest.ManagedHost/HarvestDirectoryToPayloadGroup.ps1
new file mode 100644
index 00000000..928470b0
--- /dev/null
+++ b/src/test/WixToolsetTest.ManagedHost/HarvestDirectoryToPayloadGroup.ps1
@@ -0,0 +1,42 @@
1param([string]$RootFolder, [string]$HarvestFolder, [string]$OutputFile)
2
3function harvestFileToPayload {
4 param([System.IO.FileInfo]$file, [string]$rootFolder, [string]$harvestFolder)
5
6 $sourceFile = $file.FullName.Substring($rootFolder.Length + 1)
7 $name = $sourceFile.Substring($harvestFolder.Length + 1)
8 $payloadContents = "<Payload SourceFile='$sourceFile' Name='$name' />"
9 $payloadContents
10}
11
12function harvestDirectoryToPayloadGroup {
13 param([string]$rootFolder, [string]$harvestFolder, [string]$outputFile)
14
15 $beginFileContents = @"
16<?xml version="1.0" encoding="utf-8"?>
17<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
18 <Fragment>
19 <PayloadGroup Id='
20"@
21
22 $endFileContents = @"
23 </PayloadGroup>
24 </Fragment>
25</Wix>
26"@
27
28 $fileContents = $beginFileContents
29 $payloadGroupId = $harvestFolder.Replace("\", ".")
30 $fileContents += "$payloadGroupId'>" + [System.Environment]::NewLine
31
32 $targetFolder = [System.IO.Path]::Combine($rootFolder, $harvestFolder)
33 Get-ChildItem -Path $targetFolder -Recurse -File | ForEach-Object {
34 $fileContents += ' ' + (harvestFileToPayload -file $_ -rootFolder $rootFolder -harvestFolder $harvestFolder) + [System.Environment]::NewLine
35 }
36
37 $fileContents += $endFileContents
38
39 [System.IO.File]::WriteAllText($outputFile, $fileContents)
40}
41
42harvestDirectoryToPayloadGroup -rootFolder $RootFolder -harvestFolder $HarvestFolder -outputFile $OutputFile \ No newline at end of file
diff --git a/src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/HarvestedSCD.wxs b/src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/HarvestedSCD.wxs
new file mode 100644
index 00000000..bb8d56aa
--- /dev/null
+++ b/src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/HarvestedSCD.wxs
@@ -0,0 +1,235 @@
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 <Fragment>
5 <PayloadGroup Id='publish.Example.EarliestCoreMBA.scd'>
6 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-console-l1-1-0.dll' Name='api-ms-win-core-console-l1-1-0.dll' />
7 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-datetime-l1-1-0.dll' Name='api-ms-win-core-datetime-l1-1-0.dll' />
8 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-debug-l1-1-0.dll' Name='api-ms-win-core-debug-l1-1-0.dll' />
9 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-errorhandling-l1-1-0.dll' Name='api-ms-win-core-errorhandling-l1-1-0.dll' />
10 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-file-l1-1-0.dll' Name='api-ms-win-core-file-l1-1-0.dll' />
11 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-file-l1-2-0.dll' Name='api-ms-win-core-file-l1-2-0.dll' />
12 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-file-l2-1-0.dll' Name='api-ms-win-core-file-l2-1-0.dll' />
13 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-handle-l1-1-0.dll' Name='api-ms-win-core-handle-l1-1-0.dll' />
14 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-heap-l1-1-0.dll' Name='api-ms-win-core-heap-l1-1-0.dll' />
15 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-interlocked-l1-1-0.dll' Name='api-ms-win-core-interlocked-l1-1-0.dll' />
16 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-libraryloader-l1-1-0.dll' Name='api-ms-win-core-libraryloader-l1-1-0.dll' />
17 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-localization-l1-2-0.dll' Name='api-ms-win-core-localization-l1-2-0.dll' />
18 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-memory-l1-1-0.dll' Name='api-ms-win-core-memory-l1-1-0.dll' />
19 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-namedpipe-l1-1-0.dll' Name='api-ms-win-core-namedpipe-l1-1-0.dll' />
20 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-processenvironment-l1-1-0.dll' Name='api-ms-win-core-processenvironment-l1-1-0.dll' />
21 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-processthreads-l1-1-0.dll' Name='api-ms-win-core-processthreads-l1-1-0.dll' />
22 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-processthreads-l1-1-1.dll' Name='api-ms-win-core-processthreads-l1-1-1.dll' />
23 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-profile-l1-1-0.dll' Name='api-ms-win-core-profile-l1-1-0.dll' />
24 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-rtlsupport-l1-1-0.dll' Name='api-ms-win-core-rtlsupport-l1-1-0.dll' />
25 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-string-l1-1-0.dll' Name='api-ms-win-core-string-l1-1-0.dll' />
26 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-synch-l1-1-0.dll' Name='api-ms-win-core-synch-l1-1-0.dll' />
27 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-synch-l1-2-0.dll' Name='api-ms-win-core-synch-l1-2-0.dll' />
28 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-sysinfo-l1-1-0.dll' Name='api-ms-win-core-sysinfo-l1-1-0.dll' />
29 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-timezone-l1-1-0.dll' Name='api-ms-win-core-timezone-l1-1-0.dll' />
30 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-core-util-l1-1-0.dll' Name='api-ms-win-core-util-l1-1-0.dll' />
31 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\API-MS-Win-core-xstate-l2-1-0.dll' Name='API-MS-Win-core-xstate-l2-1-0.dll' />
32 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-crt-conio-l1-1-0.dll' Name='api-ms-win-crt-conio-l1-1-0.dll' />
33 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-crt-convert-l1-1-0.dll' Name='api-ms-win-crt-convert-l1-1-0.dll' />
34 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-crt-environment-l1-1-0.dll' Name='api-ms-win-crt-environment-l1-1-0.dll' />
35 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-crt-filesystem-l1-1-0.dll' Name='api-ms-win-crt-filesystem-l1-1-0.dll' />
36 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-crt-heap-l1-1-0.dll' Name='api-ms-win-crt-heap-l1-1-0.dll' />
37 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-crt-locale-l1-1-0.dll' Name='api-ms-win-crt-locale-l1-1-0.dll' />
38 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-crt-math-l1-1-0.dll' Name='api-ms-win-crt-math-l1-1-0.dll' />
39 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-crt-multibyte-l1-1-0.dll' Name='api-ms-win-crt-multibyte-l1-1-0.dll' />
40 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-crt-private-l1-1-0.dll' Name='api-ms-win-crt-private-l1-1-0.dll' />
41 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-crt-process-l1-1-0.dll' Name='api-ms-win-crt-process-l1-1-0.dll' />
42 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-crt-runtime-l1-1-0.dll' Name='api-ms-win-crt-runtime-l1-1-0.dll' />
43 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-crt-stdio-l1-1-0.dll' Name='api-ms-win-crt-stdio-l1-1-0.dll' />
44 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-crt-string-l1-1-0.dll' Name='api-ms-win-crt-string-l1-1-0.dll' />
45 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-crt-time-l1-1-0.dll' Name='api-ms-win-crt-time-l1-1-0.dll' />
46 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\api-ms-win-crt-utility-l1-1-0.dll' Name='api-ms-win-crt-utility-l1-1-0.dll' />
47 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\clrcompression.dll' Name='clrcompression.dll' />
48 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\clretwrc.dll' Name='clretwrc.dll' />
49 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\clrjit.dll' Name='clrjit.dll' />
50 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\coreclr.dll' Name='coreclr.dll' />
51 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\dbgshim.dll' Name='dbgshim.dll' />
52 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\Example.EarliestCoreMBA.deps.json' Name='Example.EarliestCoreMBA.deps.json' />
53 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\Example.EarliestCoreMBA.dll' Name='Example.EarliestCoreMBA.dll' bal:BAFactoryAssembly='yes' />
54 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\Example.EarliestCoreMBA.pdb' Name='Example.EarliestCoreMBA.pdb' />
55 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\Example.EarliestCoreMBA.runtimeconfig.json' Name='Example.EarliestCoreMBA.runtimeconfig.json' />
56 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\hostfxr.dll' Name='hostfxr.dll' />
57 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\hostpolicy.dll' Name='hostpolicy.dll' />
58 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\mbanative.dll' Name='mbanative.dll' />
59 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\Microsoft.CSharp.dll' Name='Microsoft.CSharp.dll' />
60 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\Microsoft.DiaSymReader.Native.x86.dll' Name='Microsoft.DiaSymReader.Native.x86.dll' />
61 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\Microsoft.VisualBasic.Core.dll' Name='Microsoft.VisualBasic.Core.dll' />
62 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\Microsoft.VisualBasic.dll' Name='Microsoft.VisualBasic.dll' />
63 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\Microsoft.Win32.Primitives.dll' Name='Microsoft.Win32.Primitives.dll' />
64 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\Microsoft.Win32.Registry.dll' Name='Microsoft.Win32.Registry.dll' />
65 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\mscordaccore.dll' Name='mscordaccore.dll' />
66 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\mscordaccore_x86_x86_4.700.19.57202.dll' Name='mscordaccore_x86_x86_4.700.19.57202.dll' />
67 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\mscordbi.dll' Name='mscordbi.dll' />
68 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\mscorlib.dll' Name='mscorlib.dll' />
69 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\mscorrc.debug.dll' Name='mscorrc.debug.dll' />
70 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\mscorrc.dll' Name='mscorrc.dll' />
71 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\netstandard.dll' Name='netstandard.dll' />
72 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\SOS_README.md' Name='SOS_README.md' />
73 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.AppContext.dll' Name='System.AppContext.dll' />
74 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Buffers.dll' Name='System.Buffers.dll' />
75 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Collections.Concurrent.dll' Name='System.Collections.Concurrent.dll' />
76 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Collections.dll' Name='System.Collections.dll' />
77 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Collections.Immutable.dll' Name='System.Collections.Immutable.dll' />
78 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Collections.NonGeneric.dll' Name='System.Collections.NonGeneric.dll' />
79 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Collections.Specialized.dll' Name='System.Collections.Specialized.dll' />
80 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.ComponentModel.Annotations.dll' Name='System.ComponentModel.Annotations.dll' />
81 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.ComponentModel.DataAnnotations.dll' Name='System.ComponentModel.DataAnnotations.dll' />
82 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.ComponentModel.dll' Name='System.ComponentModel.dll' />
83 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.ComponentModel.EventBasedAsync.dll' Name='System.ComponentModel.EventBasedAsync.dll' />
84 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.ComponentModel.Primitives.dll' Name='System.ComponentModel.Primitives.dll' />
85 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.ComponentModel.TypeConverter.dll' Name='System.ComponentModel.TypeConverter.dll' />
86 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Configuration.dll' Name='System.Configuration.dll' />
87 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Console.dll' Name='System.Console.dll' />
88 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Core.dll' Name='System.Core.dll' />
89 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Data.Common.dll' Name='System.Data.Common.dll' />
90 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Data.DataSetExtensions.dll' Name='System.Data.DataSetExtensions.dll' />
91 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Data.dll' Name='System.Data.dll' />
92 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Diagnostics.Contracts.dll' Name='System.Diagnostics.Contracts.dll' />
93 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Diagnostics.Debug.dll' Name='System.Diagnostics.Debug.dll' />
94 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Diagnostics.DiagnosticSource.dll' Name='System.Diagnostics.DiagnosticSource.dll' />
95 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Diagnostics.FileVersionInfo.dll' Name='System.Diagnostics.FileVersionInfo.dll' />
96 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Diagnostics.Process.dll' Name='System.Diagnostics.Process.dll' />
97 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Diagnostics.StackTrace.dll' Name='System.Diagnostics.StackTrace.dll' />
98 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Diagnostics.TextWriterTraceListener.dll' Name='System.Diagnostics.TextWriterTraceListener.dll' />
99 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Diagnostics.Tools.dll' Name='System.Diagnostics.Tools.dll' />
100 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Diagnostics.TraceSource.dll' Name='System.Diagnostics.TraceSource.dll' />
101 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Diagnostics.Tracing.dll' Name='System.Diagnostics.Tracing.dll' />
102 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.dll' Name='System.dll' />
103 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Drawing.dll' Name='System.Drawing.dll' />
104 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Drawing.Primitives.dll' Name='System.Drawing.Primitives.dll' />
105 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Dynamic.Runtime.dll' Name='System.Dynamic.Runtime.dll' />
106 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Globalization.Calendars.dll' Name='System.Globalization.Calendars.dll' />
107 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Globalization.dll' Name='System.Globalization.dll' />
108 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Globalization.Extensions.dll' Name='System.Globalization.Extensions.dll' />
109 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.IO.Compression.Brotli.dll' Name='System.IO.Compression.Brotli.dll' />
110 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.IO.Compression.dll' Name='System.IO.Compression.dll' />
111 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.IO.Compression.FileSystem.dll' Name='System.IO.Compression.FileSystem.dll' />
112 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.IO.Compression.ZipFile.dll' Name='System.IO.Compression.ZipFile.dll' />
113 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.IO.dll' Name='System.IO.dll' />
114 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.IO.FileSystem.AccessControl.dll' Name='System.IO.FileSystem.AccessControl.dll' />
115 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.IO.FileSystem.dll' Name='System.IO.FileSystem.dll' />
116 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.IO.FileSystem.DriveInfo.dll' Name='System.IO.FileSystem.DriveInfo.dll' />
117 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.IO.FileSystem.Primitives.dll' Name='System.IO.FileSystem.Primitives.dll' />
118 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.IO.FileSystem.Watcher.dll' Name='System.IO.FileSystem.Watcher.dll' />
119 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.IO.IsolatedStorage.dll' Name='System.IO.IsolatedStorage.dll' />
120 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.IO.MemoryMappedFiles.dll' Name='System.IO.MemoryMappedFiles.dll' />
121 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.IO.Pipes.AccessControl.dll' Name='System.IO.Pipes.AccessControl.dll' />
122 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.IO.Pipes.dll' Name='System.IO.Pipes.dll' />
123 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.IO.UnmanagedMemoryStream.dll' Name='System.IO.UnmanagedMemoryStream.dll' />
124 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Linq.dll' Name='System.Linq.dll' />
125 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Linq.Expressions.dll' Name='System.Linq.Expressions.dll' />
126 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Linq.Parallel.dll' Name='System.Linq.Parallel.dll' />
127 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Linq.Queryable.dll' Name='System.Linq.Queryable.dll' />
128 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Memory.dll' Name='System.Memory.dll' />
129 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.dll' Name='System.Net.dll' />
130 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.Http.dll' Name='System.Net.Http.dll' />
131 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.HttpListener.dll' Name='System.Net.HttpListener.dll' />
132 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.Mail.dll' Name='System.Net.Mail.dll' />
133 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.NameResolution.dll' Name='System.Net.NameResolution.dll' />
134 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.NetworkInformation.dll' Name='System.Net.NetworkInformation.dll' />
135 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.Ping.dll' Name='System.Net.Ping.dll' />
136 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.Primitives.dll' Name='System.Net.Primitives.dll' />
137 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.Requests.dll' Name='System.Net.Requests.dll' />
138 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.Security.dll' Name='System.Net.Security.dll' />
139 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.ServicePoint.dll' Name='System.Net.ServicePoint.dll' />
140 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.Sockets.dll' Name='System.Net.Sockets.dll' />
141 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.WebClient.dll' Name='System.Net.WebClient.dll' />
142 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.WebHeaderCollection.dll' Name='System.Net.WebHeaderCollection.dll' />
143 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.WebProxy.dll' Name='System.Net.WebProxy.dll' />
144 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.WebSockets.Client.dll' Name='System.Net.WebSockets.Client.dll' />
145 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Net.WebSockets.dll' Name='System.Net.WebSockets.dll' />
146 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Numerics.dll' Name='System.Numerics.dll' />
147 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Numerics.Vectors.dll' Name='System.Numerics.Vectors.dll' />
148 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.ObjectModel.dll' Name='System.ObjectModel.dll' />
149 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Private.CoreLib.dll' Name='System.Private.CoreLib.dll' />
150 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Private.DataContractSerialization.dll' Name='System.Private.DataContractSerialization.dll' />
151 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Private.Uri.dll' Name='System.Private.Uri.dll' />
152 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Private.Xml.dll' Name='System.Private.Xml.dll' />
153 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Private.Xml.Linq.dll' Name='System.Private.Xml.Linq.dll' />
154 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Reflection.DispatchProxy.dll' Name='System.Reflection.DispatchProxy.dll' />
155 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Reflection.dll' Name='System.Reflection.dll' />
156 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Reflection.Emit.dll' Name='System.Reflection.Emit.dll' />
157 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Reflection.Emit.ILGeneration.dll' Name='System.Reflection.Emit.ILGeneration.dll' />
158 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Reflection.Emit.Lightweight.dll' Name='System.Reflection.Emit.Lightweight.dll' />
159 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Reflection.Extensions.dll' Name='System.Reflection.Extensions.dll' />
160 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Reflection.Metadata.dll' Name='System.Reflection.Metadata.dll' />
161 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Reflection.Primitives.dll' Name='System.Reflection.Primitives.dll' />
162 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Reflection.TypeExtensions.dll' Name='System.Reflection.TypeExtensions.dll' />
163 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Resources.Reader.dll' Name='System.Resources.Reader.dll' />
164 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Resources.ResourceManager.dll' Name='System.Resources.ResourceManager.dll' />
165 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Resources.Writer.dll' Name='System.Resources.Writer.dll' />
166 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.CompilerServices.Unsafe.dll' Name='System.Runtime.CompilerServices.Unsafe.dll' />
167 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.CompilerServices.VisualC.dll' Name='System.Runtime.CompilerServices.VisualC.dll' />
168 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.dll' Name='System.Runtime.dll' />
169 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.Extensions.dll' Name='System.Runtime.Extensions.dll' />
170 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.Handles.dll' Name='System.Runtime.Handles.dll' />
171 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.InteropServices.dll' Name='System.Runtime.InteropServices.dll' />
172 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.InteropServices.RuntimeInformation.dll' Name='System.Runtime.InteropServices.RuntimeInformation.dll' />
173 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.InteropServices.WindowsRuntime.dll' Name='System.Runtime.InteropServices.WindowsRuntime.dll' />
174 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.Intrinsics.dll' Name='System.Runtime.Intrinsics.dll' />
175 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.Loader.dll' Name='System.Runtime.Loader.dll' />
176 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.Numerics.dll' Name='System.Runtime.Numerics.dll' />
177 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.Serialization.dll' Name='System.Runtime.Serialization.dll' />
178 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.Serialization.Formatters.dll' Name='System.Runtime.Serialization.Formatters.dll' />
179 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.Serialization.Json.dll' Name='System.Runtime.Serialization.Json.dll' />
180 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.Serialization.Primitives.dll' Name='System.Runtime.Serialization.Primitives.dll' />
181 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.Serialization.Xml.dll' Name='System.Runtime.Serialization.Xml.dll' />
182 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.WindowsRuntime.dll' Name='System.Runtime.WindowsRuntime.dll' />
183 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Runtime.WindowsRuntime.UI.Xaml.dll' Name='System.Runtime.WindowsRuntime.UI.Xaml.dll' />
184 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Security.AccessControl.dll' Name='System.Security.AccessControl.dll' />
185 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Security.Claims.dll' Name='System.Security.Claims.dll' />
186 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Security.Cryptography.Algorithms.dll' Name='System.Security.Cryptography.Algorithms.dll' />
187 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Security.Cryptography.Cng.dll' Name='System.Security.Cryptography.Cng.dll' />
188 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Security.Cryptography.Csp.dll' Name='System.Security.Cryptography.Csp.dll' />
189 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Security.Cryptography.Encoding.dll' Name='System.Security.Cryptography.Encoding.dll' />
190 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Security.Cryptography.OpenSsl.dll' Name='System.Security.Cryptography.OpenSsl.dll' />
191 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Security.Cryptography.Primitives.dll' Name='System.Security.Cryptography.Primitives.dll' />
192 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Security.Cryptography.X509Certificates.dll' Name='System.Security.Cryptography.X509Certificates.dll' />
193 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Security.dll' Name='System.Security.dll' />
194 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Security.Principal.dll' Name='System.Security.Principal.dll' />
195 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Security.Principal.Windows.dll' Name='System.Security.Principal.Windows.dll' />
196 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Security.SecureString.dll' Name='System.Security.SecureString.dll' />
197 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.ServiceModel.Web.dll' Name='System.ServiceModel.Web.dll' />
198 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.ServiceProcess.dll' Name='System.ServiceProcess.dll' />
199 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Text.Encoding.CodePages.dll' Name='System.Text.Encoding.CodePages.dll' />
200 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Text.Encoding.dll' Name='System.Text.Encoding.dll' />
201 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Text.Encoding.Extensions.dll' Name='System.Text.Encoding.Extensions.dll' />
202 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Text.Encodings.Web.dll' Name='System.Text.Encodings.Web.dll' />
203 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Text.Json.dll' Name='System.Text.Json.dll' />
204 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Text.RegularExpressions.dll' Name='System.Text.RegularExpressions.dll' />
205 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Threading.Channels.dll' Name='System.Threading.Channels.dll' />
206 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Threading.dll' Name='System.Threading.dll' />
207 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Threading.Overlapped.dll' Name='System.Threading.Overlapped.dll' />
208 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Threading.Tasks.Dataflow.dll' Name='System.Threading.Tasks.Dataflow.dll' />
209 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Threading.Tasks.dll' Name='System.Threading.Tasks.dll' />
210 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Threading.Tasks.Extensions.dll' Name='System.Threading.Tasks.Extensions.dll' />
211 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Threading.Tasks.Parallel.dll' Name='System.Threading.Tasks.Parallel.dll' />
212 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Threading.Thread.dll' Name='System.Threading.Thread.dll' />
213 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Threading.ThreadPool.dll' Name='System.Threading.ThreadPool.dll' />
214 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Threading.Timer.dll' Name='System.Threading.Timer.dll' />
215 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Transactions.dll' Name='System.Transactions.dll' />
216 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Transactions.Local.dll' Name='System.Transactions.Local.dll' />
217 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.ValueTuple.dll' Name='System.ValueTuple.dll' />
218 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Web.dll' Name='System.Web.dll' />
219 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Web.HttpUtility.dll' Name='System.Web.HttpUtility.dll' />
220 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Windows.dll' Name='System.Windows.dll' />
221 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Xml.dll' Name='System.Xml.dll' />
222 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Xml.Linq.dll' Name='System.Xml.Linq.dll' />
223 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Xml.ReaderWriter.dll' Name='System.Xml.ReaderWriter.dll' />
224 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Xml.Serialization.dll' Name='System.Xml.Serialization.dll' />
225 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Xml.XDocument.dll' Name='System.Xml.XDocument.dll' />
226 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Xml.XmlDocument.dll' Name='System.Xml.XmlDocument.dll' />
227 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Xml.XmlSerializer.dll' Name='System.Xml.XmlSerializer.dll' />
228 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Xml.XPath.dll' Name='System.Xml.XPath.dll' />
229 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\System.Xml.XPath.XDocument.dll' Name='System.Xml.XPath.XDocument.dll' />
230 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\ucrtbase.dll' Name='ucrtbase.dll' />
231 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\WindowsBase.dll' Name='WindowsBase.dll' />
232 <Payload SourceFile='publish\Example.EarliestCoreMBA\scd\WixToolset.Mba.Core.dll' Name='WixToolset.Mba.Core.dll' />
233 </PayloadGroup>
234 </Fragment>
235</Wix> \ No newline at end of file
diff --git a/src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/HarvestedTrimmedSCD.wxs b/src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/HarvestedTrimmedSCD.wxs
new file mode 100644
index 00000000..336eef4c
--- /dev/null
+++ b/src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/HarvestedTrimmedSCD.wxs
@@ -0,0 +1,113 @@
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 <Fragment>
5 <PayloadGroup Id='publish.Example.EarliestCoreMBA.trimmedscd'>
6 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-console-l1-1-0.dll' Name='api-ms-win-core-console-l1-1-0.dll' />
7 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-datetime-l1-1-0.dll' Name='api-ms-win-core-datetime-l1-1-0.dll' />
8 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-debug-l1-1-0.dll' Name='api-ms-win-core-debug-l1-1-0.dll' />
9 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-errorhandling-l1-1-0.dll' Name='api-ms-win-core-errorhandling-l1-1-0.dll' />
10 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-file-l1-1-0.dll' Name='api-ms-win-core-file-l1-1-0.dll' />
11 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-file-l1-2-0.dll' Name='api-ms-win-core-file-l1-2-0.dll' />
12 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-file-l2-1-0.dll' Name='api-ms-win-core-file-l2-1-0.dll' />
13 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-handle-l1-1-0.dll' Name='api-ms-win-core-handle-l1-1-0.dll' />
14 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-heap-l1-1-0.dll' Name='api-ms-win-core-heap-l1-1-0.dll' />
15 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-interlocked-l1-1-0.dll' Name='api-ms-win-core-interlocked-l1-1-0.dll' />
16 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-libraryloader-l1-1-0.dll' Name='api-ms-win-core-libraryloader-l1-1-0.dll' />
17 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-localization-l1-2-0.dll' Name='api-ms-win-core-localization-l1-2-0.dll' />
18 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-memory-l1-1-0.dll' Name='api-ms-win-core-memory-l1-1-0.dll' />
19 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-namedpipe-l1-1-0.dll' Name='api-ms-win-core-namedpipe-l1-1-0.dll' />
20 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-processenvironment-l1-1-0.dll' Name='api-ms-win-core-processenvironment-l1-1-0.dll' />
21 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-processthreads-l1-1-0.dll' Name='api-ms-win-core-processthreads-l1-1-0.dll' />
22 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-processthreads-l1-1-1.dll' Name='api-ms-win-core-processthreads-l1-1-1.dll' />
23 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-profile-l1-1-0.dll' Name='api-ms-win-core-profile-l1-1-0.dll' />
24 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-rtlsupport-l1-1-0.dll' Name='api-ms-win-core-rtlsupport-l1-1-0.dll' />
25 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-string-l1-1-0.dll' Name='api-ms-win-core-string-l1-1-0.dll' />
26 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-synch-l1-1-0.dll' Name='api-ms-win-core-synch-l1-1-0.dll' />
27 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-synch-l1-2-0.dll' Name='api-ms-win-core-synch-l1-2-0.dll' />
28 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-sysinfo-l1-1-0.dll' Name='api-ms-win-core-sysinfo-l1-1-0.dll' />
29 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-timezone-l1-1-0.dll' Name='api-ms-win-core-timezone-l1-1-0.dll' />
30 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-core-util-l1-1-0.dll' Name='api-ms-win-core-util-l1-1-0.dll' />
31 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\API-MS-Win-core-xstate-l2-1-0.dll' Name='API-MS-Win-core-xstate-l2-1-0.dll' />
32 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-crt-conio-l1-1-0.dll' Name='api-ms-win-crt-conio-l1-1-0.dll' />
33 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-crt-convert-l1-1-0.dll' Name='api-ms-win-crt-convert-l1-1-0.dll' />
34 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-crt-environment-l1-1-0.dll' Name='api-ms-win-crt-environment-l1-1-0.dll' />
35 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-crt-filesystem-l1-1-0.dll' Name='api-ms-win-crt-filesystem-l1-1-0.dll' />
36 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-crt-heap-l1-1-0.dll' Name='api-ms-win-crt-heap-l1-1-0.dll' />
37 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-crt-locale-l1-1-0.dll' Name='api-ms-win-crt-locale-l1-1-0.dll' />
38 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-crt-math-l1-1-0.dll' Name='api-ms-win-crt-math-l1-1-0.dll' />
39 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-crt-multibyte-l1-1-0.dll' Name='api-ms-win-crt-multibyte-l1-1-0.dll' />
40 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-crt-private-l1-1-0.dll' Name='api-ms-win-crt-private-l1-1-0.dll' />
41 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-crt-process-l1-1-0.dll' Name='api-ms-win-crt-process-l1-1-0.dll' />
42 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-crt-runtime-l1-1-0.dll' Name='api-ms-win-crt-runtime-l1-1-0.dll' />
43 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-crt-stdio-l1-1-0.dll' Name='api-ms-win-crt-stdio-l1-1-0.dll' />
44 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-crt-string-l1-1-0.dll' Name='api-ms-win-crt-string-l1-1-0.dll' />
45 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-crt-time-l1-1-0.dll' Name='api-ms-win-crt-time-l1-1-0.dll' />
46 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\api-ms-win-crt-utility-l1-1-0.dll' Name='api-ms-win-crt-utility-l1-1-0.dll' />
47 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\clrcompression.dll' Name='clrcompression.dll' />
48 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\clretwrc.dll' Name='clretwrc.dll' />
49 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\clrjit.dll' Name='clrjit.dll' />
50 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\coreclr.dll' Name='coreclr.dll' />
51 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\dbgshim.dll' Name='dbgshim.dll' />
52 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\Example.EarliestCoreMBA.deps.json' Name='Example.EarliestCoreMBA.deps.json' />
53 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\Example.EarliestCoreMBA.dll' Name='Example.EarliestCoreMBA.dll' bal:BAFactoryAssembly='yes' />
54 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\Example.EarliestCoreMBA.pdb' Name='Example.EarliestCoreMBA.pdb' />
55 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\Example.EarliestCoreMBA.runtimeconfig.json' Name='Example.EarliestCoreMBA.runtimeconfig.json' />
56 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\hostfxr.dll' Name='hostfxr.dll' />
57 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\hostpolicy.dll' Name='hostpolicy.dll' />
58 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\mbanative.dll' Name='mbanative.dll' />
59 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\Microsoft.DiaSymReader.Native.x86.dll' Name='Microsoft.DiaSymReader.Native.x86.dll' />
60 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\Microsoft.Win32.Primitives.dll' Name='Microsoft.Win32.Primitives.dll' />
61 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\mscordaccore.dll' Name='mscordaccore.dll' />
62 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\mscordaccore_x86_x86_4.700.19.57202.dll' Name='mscordaccore_x86_x86_4.700.19.57202.dll' />
63 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\mscordbi.dll' Name='mscordbi.dll' />
64 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\mscorrc.debug.dll' Name='mscorrc.debug.dll' />
65 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\mscorrc.dll' Name='mscorrc.dll' />
66 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\SOS_README.md' Name='SOS_README.md' />
67 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Collections.Concurrent.dll' Name='System.Collections.Concurrent.dll' />
68 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Collections.dll' Name='System.Collections.dll' />
69 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Collections.NonGeneric.dll' Name='System.Collections.NonGeneric.dll' />
70 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Collections.Specialized.dll' Name='System.Collections.Specialized.dll' />
71 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Diagnostics.DiagnosticSource.dll' Name='System.Diagnostics.DiagnosticSource.dll' />
72 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Diagnostics.StackTrace.dll' Name='System.Diagnostics.StackTrace.dll' />
73 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Diagnostics.Tools.dll' Name='System.Diagnostics.Tools.dll' />
74 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.IO.Compression.Brotli.dll' Name='System.IO.Compression.Brotli.dll' />
75 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.IO.Compression.dll' Name='System.IO.Compression.dll' />
76 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.IO.FileSystem.dll' Name='System.IO.FileSystem.dll' />
77 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Linq.dll' Name='System.Linq.dll' />
78 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Net.Http.dll' Name='System.Net.Http.dll' />
79 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Net.NameResolution.dll' Name='System.Net.NameResolution.dll' />
80 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Net.NetworkInformation.dll' Name='System.Net.NetworkInformation.dll' />
81 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Net.Primitives.dll' Name='System.Net.Primitives.dll' />
82 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Net.Requests.dll' Name='System.Net.Requests.dll' />
83 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Net.Security.dll' Name='System.Net.Security.dll' />
84 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Net.ServicePoint.dll' Name='System.Net.ServicePoint.dll' />
85 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Net.Sockets.dll' Name='System.Net.Sockets.dll' />
86 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Net.WebHeaderCollection.dll' Name='System.Net.WebHeaderCollection.dll' />
87 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.ObjectModel.dll' Name='System.ObjectModel.dll' />
88 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Private.CoreLib.dll' Name='System.Private.CoreLib.dll' />
89 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Private.Uri.dll' Name='System.Private.Uri.dll' />
90 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Private.Xml.dll' Name='System.Private.Xml.dll' />
91 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Private.Xml.Linq.dll' Name='System.Private.Xml.Linq.dll' />
92 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Reflection.Metadata.dll' Name='System.Reflection.Metadata.dll' />
93 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Runtime.CompilerServices.Unsafe.dll' Name='System.Runtime.CompilerServices.Unsafe.dll' />
94 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Runtime.dll' Name='System.Runtime.dll' />
95 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Runtime.Extensions.dll' Name='System.Runtime.Extensions.dll' />
96 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Runtime.Loader.dll' Name='System.Runtime.Loader.dll' />
97 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Runtime.Numerics.dll' Name='System.Runtime.Numerics.dll' />
98 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Runtime.Serialization.Formatters.dll' Name='System.Runtime.Serialization.Formatters.dll' />
99 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Security.Claims.dll' Name='System.Security.Claims.dll' />
100 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Security.Cryptography.Algorithms.dll' Name='System.Security.Cryptography.Algorithms.dll' />
101 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Security.Cryptography.Cng.dll' Name='System.Security.Cryptography.Cng.dll' />
102 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Security.Cryptography.Csp.dll' Name='System.Security.Cryptography.Csp.dll' />
103 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Security.Cryptography.Encoding.dll' Name='System.Security.Cryptography.Encoding.dll' />
104 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Security.Cryptography.Primitives.dll' Name='System.Security.Cryptography.Primitives.dll' />
105 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Security.Cryptography.X509Certificates.dll' Name='System.Security.Cryptography.X509Certificates.dll' />
106 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Security.Principal.dll' Name='System.Security.Principal.dll' />
107 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Security.Principal.Windows.dll' Name='System.Security.Principal.Windows.dll' />
108 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\System.Text.RegularExpressions.dll' Name='System.Text.RegularExpressions.dll' />
109 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\ucrtbase.dll' Name='ucrtbase.dll' />
110 <Payload SourceFile='publish\Example.EarliestCoreMBA\trimmedscd\WixToolset.Mba.Core.dll' Name='WixToolset.Mba.Core.dll' />
111 </PayloadGroup>
112 </Fragment>
113</Wix> \ No newline at end of file
diff --git a/src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/SelfContainedBundle.wxs b/src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/SelfContainedBundle.wxs
new file mode 100644
index 00000000..4f3b2f20
--- /dev/null
+++ b/src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/SelfContainedBundle.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="SCDEarliestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533">
5 <BootstrapperApplicationRef Id="DotNetCoreBootstrapperApplicationHost">
6 <PayloadGroupRef Id="publish.Example.EarliestCoreMBA.scd" />
7 </BootstrapperApplicationRef>
8 <Chain>
9 <ExePackage SourceFile="c:\windows\system32\kernel32.dll" PerMachine="yes" />
10 </Chain>
11 </Bundle>
12</Wix>
diff --git a/src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/TrimmedSelfContainedBundle.wxs b/src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/TrimmedSelfContainedBundle.wxs
new file mode 100644
index 00000000..15dc72bb
--- /dev/null
+++ b/src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/TrimmedSelfContainedBundle.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="TrimmedSCDEarliestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533">
5 <BootstrapperApplicationRef Id="DotNetCoreBootstrapperApplicationHost">
6 <PayloadGroupRef Id="publish.Example.EarliestCoreMBA.trimmedscd" />
7 </BootstrapperApplicationRef>
8 <Chain>
9 <ExePackage SourceFile="c:\windows\system32\kernel32.dll" PerMachine="yes" />
10 </Chain>
11 </Bundle>
12</Wix>
diff --git a/src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/HarvestedSCD.wxs b/src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/HarvestedSCD.wxs
new file mode 100644
index 00000000..09433669
--- /dev/null
+++ b/src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/HarvestedSCD.wxs
@@ -0,0 +1,235 @@
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 <Fragment>
5 <PayloadGroup Id='publish.Example.LatestCoreMBA.scd'>
6 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-console-l1-1-0.dll' Name='api-ms-win-core-console-l1-1-0.dll' />
7 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-datetime-l1-1-0.dll' Name='api-ms-win-core-datetime-l1-1-0.dll' />
8 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-debug-l1-1-0.dll' Name='api-ms-win-core-debug-l1-1-0.dll' />
9 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-errorhandling-l1-1-0.dll' Name='api-ms-win-core-errorhandling-l1-1-0.dll' />
10 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-file-l1-1-0.dll' Name='api-ms-win-core-file-l1-1-0.dll' />
11 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-file-l1-2-0.dll' Name='api-ms-win-core-file-l1-2-0.dll' />
12 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-file-l2-1-0.dll' Name='api-ms-win-core-file-l2-1-0.dll' />
13 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-handle-l1-1-0.dll' Name='api-ms-win-core-handle-l1-1-0.dll' />
14 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-heap-l1-1-0.dll' Name='api-ms-win-core-heap-l1-1-0.dll' />
15 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-interlocked-l1-1-0.dll' Name='api-ms-win-core-interlocked-l1-1-0.dll' />
16 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-libraryloader-l1-1-0.dll' Name='api-ms-win-core-libraryloader-l1-1-0.dll' />
17 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-localization-l1-2-0.dll' Name='api-ms-win-core-localization-l1-2-0.dll' />
18 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-memory-l1-1-0.dll' Name='api-ms-win-core-memory-l1-1-0.dll' />
19 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-namedpipe-l1-1-0.dll' Name='api-ms-win-core-namedpipe-l1-1-0.dll' />
20 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-processenvironment-l1-1-0.dll' Name='api-ms-win-core-processenvironment-l1-1-0.dll' />
21 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-processthreads-l1-1-0.dll' Name='api-ms-win-core-processthreads-l1-1-0.dll' />
22 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-processthreads-l1-1-1.dll' Name='api-ms-win-core-processthreads-l1-1-1.dll' />
23 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-profile-l1-1-0.dll' Name='api-ms-win-core-profile-l1-1-0.dll' />
24 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-rtlsupport-l1-1-0.dll' Name='api-ms-win-core-rtlsupport-l1-1-0.dll' />
25 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-string-l1-1-0.dll' Name='api-ms-win-core-string-l1-1-0.dll' />
26 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-synch-l1-1-0.dll' Name='api-ms-win-core-synch-l1-1-0.dll' />
27 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-synch-l1-2-0.dll' Name='api-ms-win-core-synch-l1-2-0.dll' />
28 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-sysinfo-l1-1-0.dll' Name='api-ms-win-core-sysinfo-l1-1-0.dll' />
29 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-timezone-l1-1-0.dll' Name='api-ms-win-core-timezone-l1-1-0.dll' />
30 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-core-util-l1-1-0.dll' Name='api-ms-win-core-util-l1-1-0.dll' />
31 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\API-MS-Win-core-xstate-l2-1-0.dll' Name='API-MS-Win-core-xstate-l2-1-0.dll' />
32 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-crt-conio-l1-1-0.dll' Name='api-ms-win-crt-conio-l1-1-0.dll' />
33 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-crt-convert-l1-1-0.dll' Name='api-ms-win-crt-convert-l1-1-0.dll' />
34 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-crt-environment-l1-1-0.dll' Name='api-ms-win-crt-environment-l1-1-0.dll' />
35 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-crt-filesystem-l1-1-0.dll' Name='api-ms-win-crt-filesystem-l1-1-0.dll' />
36 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-crt-heap-l1-1-0.dll' Name='api-ms-win-crt-heap-l1-1-0.dll' />
37 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-crt-locale-l1-1-0.dll' Name='api-ms-win-crt-locale-l1-1-0.dll' />
38 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-crt-math-l1-1-0.dll' Name='api-ms-win-crt-math-l1-1-0.dll' />
39 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-crt-multibyte-l1-1-0.dll' Name='api-ms-win-crt-multibyte-l1-1-0.dll' />
40 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-crt-private-l1-1-0.dll' Name='api-ms-win-crt-private-l1-1-0.dll' />
41 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-crt-process-l1-1-0.dll' Name='api-ms-win-crt-process-l1-1-0.dll' />
42 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-crt-runtime-l1-1-0.dll' Name='api-ms-win-crt-runtime-l1-1-0.dll' />
43 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-crt-stdio-l1-1-0.dll' Name='api-ms-win-crt-stdio-l1-1-0.dll' />
44 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-crt-string-l1-1-0.dll' Name='api-ms-win-crt-string-l1-1-0.dll' />
45 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-crt-time-l1-1-0.dll' Name='api-ms-win-crt-time-l1-1-0.dll' />
46 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\api-ms-win-crt-utility-l1-1-0.dll' Name='api-ms-win-crt-utility-l1-1-0.dll' />
47 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\clrcompression.dll' Name='clrcompression.dll' />
48 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\clretwrc.dll' Name='clretwrc.dll' />
49 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\clrjit.dll' Name='clrjit.dll' />
50 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\coreclr.dll' Name='coreclr.dll' />
51 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\dbgshim.dll' Name='dbgshim.dll' />
52 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\Example.LatestCoreMBA.deps.json' Name='Example.LatestCoreMBA.deps.json' />
53 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\Example.LatestCoreMBA.dll' Name='Example.LatestCoreMBA.dll' bal:BAFactoryAssembly='yes' />
54 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\Example.LatestCoreMBA.pdb' Name='Example.LatestCoreMBA.pdb' />
55 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\Example.LatestCoreMBA.runtimeconfig.json' Name='Example.LatestCoreMBA.runtimeconfig.json' />
56 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\hostfxr.dll' Name='hostfxr.dll' />
57 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\hostpolicy.dll' Name='hostpolicy.dll' />
58 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\mbanative.dll' Name='mbanative.dll' />
59 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\Microsoft.CSharp.dll' Name='Microsoft.CSharp.dll' />
60 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\Microsoft.DiaSymReader.Native.x86.dll' Name='Microsoft.DiaSymReader.Native.x86.dll' />
61 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\Microsoft.VisualBasic.Core.dll' Name='Microsoft.VisualBasic.Core.dll' />
62 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\Microsoft.VisualBasic.dll' Name='Microsoft.VisualBasic.dll' />
63 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\Microsoft.Win32.Primitives.dll' Name='Microsoft.Win32.Primitives.dll' />
64 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\Microsoft.Win32.Registry.dll' Name='Microsoft.Win32.Registry.dll' />
65 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\mscordaccore.dll' Name='mscordaccore.dll' />
66 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\mscordaccore_x86_x86_4.700.19.60701.dll' Name='mscordaccore_x86_x86_4.700.19.60701.dll' />
67 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\mscordbi.dll' Name='mscordbi.dll' />
68 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\mscorlib.dll' Name='mscorlib.dll' />
69 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\mscorrc.debug.dll' Name='mscorrc.debug.dll' />
70 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\mscorrc.dll' Name='mscorrc.dll' />
71 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\netstandard.dll' Name='netstandard.dll' />
72 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\SOS_README.md' Name='SOS_README.md' />
73 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.AppContext.dll' Name='System.AppContext.dll' />
74 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Buffers.dll' Name='System.Buffers.dll' />
75 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Collections.Concurrent.dll' Name='System.Collections.Concurrent.dll' />
76 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Collections.dll' Name='System.Collections.dll' />
77 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Collections.Immutable.dll' Name='System.Collections.Immutable.dll' />
78 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Collections.NonGeneric.dll' Name='System.Collections.NonGeneric.dll' />
79 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Collections.Specialized.dll' Name='System.Collections.Specialized.dll' />
80 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.ComponentModel.Annotations.dll' Name='System.ComponentModel.Annotations.dll' />
81 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.ComponentModel.DataAnnotations.dll' Name='System.ComponentModel.DataAnnotations.dll' />
82 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.ComponentModel.dll' Name='System.ComponentModel.dll' />
83 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.ComponentModel.EventBasedAsync.dll' Name='System.ComponentModel.EventBasedAsync.dll' />
84 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.ComponentModel.Primitives.dll' Name='System.ComponentModel.Primitives.dll' />
85 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.ComponentModel.TypeConverter.dll' Name='System.ComponentModel.TypeConverter.dll' />
86 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Configuration.dll' Name='System.Configuration.dll' />
87 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Console.dll' Name='System.Console.dll' />
88 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Core.dll' Name='System.Core.dll' />
89 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Data.Common.dll' Name='System.Data.Common.dll' />
90 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Data.DataSetExtensions.dll' Name='System.Data.DataSetExtensions.dll' />
91 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Data.dll' Name='System.Data.dll' />
92 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Diagnostics.Contracts.dll' Name='System.Diagnostics.Contracts.dll' />
93 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Diagnostics.Debug.dll' Name='System.Diagnostics.Debug.dll' />
94 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Diagnostics.DiagnosticSource.dll' Name='System.Diagnostics.DiagnosticSource.dll' />
95 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Diagnostics.FileVersionInfo.dll' Name='System.Diagnostics.FileVersionInfo.dll' />
96 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Diagnostics.Process.dll' Name='System.Diagnostics.Process.dll' />
97 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Diagnostics.StackTrace.dll' Name='System.Diagnostics.StackTrace.dll' />
98 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Diagnostics.TextWriterTraceListener.dll' Name='System.Diagnostics.TextWriterTraceListener.dll' />
99 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Diagnostics.Tools.dll' Name='System.Diagnostics.Tools.dll' />
100 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Diagnostics.TraceSource.dll' Name='System.Diagnostics.TraceSource.dll' />
101 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Diagnostics.Tracing.dll' Name='System.Diagnostics.Tracing.dll' />
102 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.dll' Name='System.dll' />
103 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Drawing.dll' Name='System.Drawing.dll' />
104 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Drawing.Primitives.dll' Name='System.Drawing.Primitives.dll' />
105 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Dynamic.Runtime.dll' Name='System.Dynamic.Runtime.dll' />
106 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Globalization.Calendars.dll' Name='System.Globalization.Calendars.dll' />
107 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Globalization.dll' Name='System.Globalization.dll' />
108 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Globalization.Extensions.dll' Name='System.Globalization.Extensions.dll' />
109 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.IO.Compression.Brotli.dll' Name='System.IO.Compression.Brotli.dll' />
110 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.IO.Compression.dll' Name='System.IO.Compression.dll' />
111 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.IO.Compression.FileSystem.dll' Name='System.IO.Compression.FileSystem.dll' />
112 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.IO.Compression.ZipFile.dll' Name='System.IO.Compression.ZipFile.dll' />
113 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.IO.dll' Name='System.IO.dll' />
114 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.IO.FileSystem.AccessControl.dll' Name='System.IO.FileSystem.AccessControl.dll' />
115 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.IO.FileSystem.dll' Name='System.IO.FileSystem.dll' />
116 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.IO.FileSystem.DriveInfo.dll' Name='System.IO.FileSystem.DriveInfo.dll' />
117 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.IO.FileSystem.Primitives.dll' Name='System.IO.FileSystem.Primitives.dll' />
118 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.IO.FileSystem.Watcher.dll' Name='System.IO.FileSystem.Watcher.dll' />
119 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.IO.IsolatedStorage.dll' Name='System.IO.IsolatedStorage.dll' />
120 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.IO.MemoryMappedFiles.dll' Name='System.IO.MemoryMappedFiles.dll' />
121 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.IO.Pipes.AccessControl.dll' Name='System.IO.Pipes.AccessControl.dll' />
122 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.IO.Pipes.dll' Name='System.IO.Pipes.dll' />
123 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.IO.UnmanagedMemoryStream.dll' Name='System.IO.UnmanagedMemoryStream.dll' />
124 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Linq.dll' Name='System.Linq.dll' />
125 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Linq.Expressions.dll' Name='System.Linq.Expressions.dll' />
126 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Linq.Parallel.dll' Name='System.Linq.Parallel.dll' />
127 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Linq.Queryable.dll' Name='System.Linq.Queryable.dll' />
128 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Memory.dll' Name='System.Memory.dll' />
129 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.dll' Name='System.Net.dll' />
130 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.Http.dll' Name='System.Net.Http.dll' />
131 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.HttpListener.dll' Name='System.Net.HttpListener.dll' />
132 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.Mail.dll' Name='System.Net.Mail.dll' />
133 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.NameResolution.dll' Name='System.Net.NameResolution.dll' />
134 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.NetworkInformation.dll' Name='System.Net.NetworkInformation.dll' />
135 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.Ping.dll' Name='System.Net.Ping.dll' />
136 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.Primitives.dll' Name='System.Net.Primitives.dll' />
137 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.Requests.dll' Name='System.Net.Requests.dll' />
138 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.Security.dll' Name='System.Net.Security.dll' />
139 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.ServicePoint.dll' Name='System.Net.ServicePoint.dll' />
140 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.Sockets.dll' Name='System.Net.Sockets.dll' />
141 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.WebClient.dll' Name='System.Net.WebClient.dll' />
142 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.WebHeaderCollection.dll' Name='System.Net.WebHeaderCollection.dll' />
143 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.WebProxy.dll' Name='System.Net.WebProxy.dll' />
144 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.WebSockets.Client.dll' Name='System.Net.WebSockets.Client.dll' />
145 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Net.WebSockets.dll' Name='System.Net.WebSockets.dll' />
146 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Numerics.dll' Name='System.Numerics.dll' />
147 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Numerics.Vectors.dll' Name='System.Numerics.Vectors.dll' />
148 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.ObjectModel.dll' Name='System.ObjectModel.dll' />
149 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Private.CoreLib.dll' Name='System.Private.CoreLib.dll' />
150 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Private.DataContractSerialization.dll' Name='System.Private.DataContractSerialization.dll' />
151 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Private.Uri.dll' Name='System.Private.Uri.dll' />
152 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Private.Xml.dll' Name='System.Private.Xml.dll' />
153 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Private.Xml.Linq.dll' Name='System.Private.Xml.Linq.dll' />
154 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Reflection.DispatchProxy.dll' Name='System.Reflection.DispatchProxy.dll' />
155 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Reflection.dll' Name='System.Reflection.dll' />
156 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Reflection.Emit.dll' Name='System.Reflection.Emit.dll' />
157 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Reflection.Emit.ILGeneration.dll' Name='System.Reflection.Emit.ILGeneration.dll' />
158 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Reflection.Emit.Lightweight.dll' Name='System.Reflection.Emit.Lightweight.dll' />
159 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Reflection.Extensions.dll' Name='System.Reflection.Extensions.dll' />
160 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Reflection.Metadata.dll' Name='System.Reflection.Metadata.dll' />
161 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Reflection.Primitives.dll' Name='System.Reflection.Primitives.dll' />
162 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Reflection.TypeExtensions.dll' Name='System.Reflection.TypeExtensions.dll' />
163 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Resources.Reader.dll' Name='System.Resources.Reader.dll' />
164 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Resources.ResourceManager.dll' Name='System.Resources.ResourceManager.dll' />
165 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Resources.Writer.dll' Name='System.Resources.Writer.dll' />
166 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.CompilerServices.Unsafe.dll' Name='System.Runtime.CompilerServices.Unsafe.dll' />
167 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.CompilerServices.VisualC.dll' Name='System.Runtime.CompilerServices.VisualC.dll' />
168 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.dll' Name='System.Runtime.dll' />
169 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.Extensions.dll' Name='System.Runtime.Extensions.dll' />
170 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.Handles.dll' Name='System.Runtime.Handles.dll' />
171 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.InteropServices.dll' Name='System.Runtime.InteropServices.dll' />
172 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.InteropServices.RuntimeInformation.dll' Name='System.Runtime.InteropServices.RuntimeInformation.dll' />
173 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.InteropServices.WindowsRuntime.dll' Name='System.Runtime.InteropServices.WindowsRuntime.dll' />
174 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.Intrinsics.dll' Name='System.Runtime.Intrinsics.dll' />
175 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.Loader.dll' Name='System.Runtime.Loader.dll' />
176 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.Numerics.dll' Name='System.Runtime.Numerics.dll' />
177 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.Serialization.dll' Name='System.Runtime.Serialization.dll' />
178 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.Serialization.Formatters.dll' Name='System.Runtime.Serialization.Formatters.dll' />
179 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.Serialization.Json.dll' Name='System.Runtime.Serialization.Json.dll' />
180 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.Serialization.Primitives.dll' Name='System.Runtime.Serialization.Primitives.dll' />
181 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.Serialization.Xml.dll' Name='System.Runtime.Serialization.Xml.dll' />
182 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.WindowsRuntime.dll' Name='System.Runtime.WindowsRuntime.dll' />
183 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Runtime.WindowsRuntime.UI.Xaml.dll' Name='System.Runtime.WindowsRuntime.UI.Xaml.dll' />
184 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Security.AccessControl.dll' Name='System.Security.AccessControl.dll' />
185 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Security.Claims.dll' Name='System.Security.Claims.dll' />
186 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Security.Cryptography.Algorithms.dll' Name='System.Security.Cryptography.Algorithms.dll' />
187 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Security.Cryptography.Cng.dll' Name='System.Security.Cryptography.Cng.dll' />
188 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Security.Cryptography.Csp.dll' Name='System.Security.Cryptography.Csp.dll' />
189 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Security.Cryptography.Encoding.dll' Name='System.Security.Cryptography.Encoding.dll' />
190 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Security.Cryptography.OpenSsl.dll' Name='System.Security.Cryptography.OpenSsl.dll' />
191 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Security.Cryptography.Primitives.dll' Name='System.Security.Cryptography.Primitives.dll' />
192 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Security.Cryptography.X509Certificates.dll' Name='System.Security.Cryptography.X509Certificates.dll' />
193 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Security.dll' Name='System.Security.dll' />
194 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Security.Principal.dll' Name='System.Security.Principal.dll' />
195 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Security.Principal.Windows.dll' Name='System.Security.Principal.Windows.dll' />
196 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Security.SecureString.dll' Name='System.Security.SecureString.dll' />
197 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.ServiceModel.Web.dll' Name='System.ServiceModel.Web.dll' />
198 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.ServiceProcess.dll' Name='System.ServiceProcess.dll' />
199 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Text.Encoding.CodePages.dll' Name='System.Text.Encoding.CodePages.dll' />
200 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Text.Encoding.dll' Name='System.Text.Encoding.dll' />
201 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Text.Encoding.Extensions.dll' Name='System.Text.Encoding.Extensions.dll' />
202 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Text.Encodings.Web.dll' Name='System.Text.Encodings.Web.dll' />
203 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Text.Json.dll' Name='System.Text.Json.dll' />
204 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Text.RegularExpressions.dll' Name='System.Text.RegularExpressions.dll' />
205 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Threading.Channels.dll' Name='System.Threading.Channels.dll' />
206 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Threading.dll' Name='System.Threading.dll' />
207 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Threading.Overlapped.dll' Name='System.Threading.Overlapped.dll' />
208 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Threading.Tasks.Dataflow.dll' Name='System.Threading.Tasks.Dataflow.dll' />
209 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Threading.Tasks.dll' Name='System.Threading.Tasks.dll' />
210 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Threading.Tasks.Extensions.dll' Name='System.Threading.Tasks.Extensions.dll' />
211 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Threading.Tasks.Parallel.dll' Name='System.Threading.Tasks.Parallel.dll' />
212 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Threading.Thread.dll' Name='System.Threading.Thread.dll' />
213 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Threading.ThreadPool.dll' Name='System.Threading.ThreadPool.dll' />
214 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Threading.Timer.dll' Name='System.Threading.Timer.dll' />
215 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Transactions.dll' Name='System.Transactions.dll' />
216 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Transactions.Local.dll' Name='System.Transactions.Local.dll' />
217 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.ValueTuple.dll' Name='System.ValueTuple.dll' />
218 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Web.dll' Name='System.Web.dll' />
219 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Web.HttpUtility.dll' Name='System.Web.HttpUtility.dll' />
220 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Windows.dll' Name='System.Windows.dll' />
221 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Xml.dll' Name='System.Xml.dll' />
222 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Xml.Linq.dll' Name='System.Xml.Linq.dll' />
223 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Xml.ReaderWriter.dll' Name='System.Xml.ReaderWriter.dll' />
224 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Xml.Serialization.dll' Name='System.Xml.Serialization.dll' />
225 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Xml.XDocument.dll' Name='System.Xml.XDocument.dll' />
226 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Xml.XmlDocument.dll' Name='System.Xml.XmlDocument.dll' />
227 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Xml.XmlSerializer.dll' Name='System.Xml.XmlSerializer.dll' />
228 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Xml.XPath.dll' Name='System.Xml.XPath.dll' />
229 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\System.Xml.XPath.XDocument.dll' Name='System.Xml.XPath.XDocument.dll' />
230 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\ucrtbase.dll' Name='ucrtbase.dll' />
231 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\WindowsBase.dll' Name='WindowsBase.dll' />
232 <Payload SourceFile='publish\Example.LatestCoreMBA\scd\WixToolset.Mba.Core.dll' Name='WixToolset.Mba.Core.dll' />
233 </PayloadGroup>
234 </Fragment>
235</Wix> \ No newline at end of file
diff --git a/src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/HarvestedTrimmedSCD.wxs b/src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/HarvestedTrimmedSCD.wxs
new file mode 100644
index 00000000..58ba7b39
--- /dev/null
+++ b/src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/HarvestedTrimmedSCD.wxs
@@ -0,0 +1,113 @@
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 <Fragment>
5 <PayloadGroup Id='publish.Example.LatestCoreMBA.trimmedscd'>
6 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-console-l1-1-0.dll' Name='api-ms-win-core-console-l1-1-0.dll' />
7 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-datetime-l1-1-0.dll' Name='api-ms-win-core-datetime-l1-1-0.dll' />
8 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-debug-l1-1-0.dll' Name='api-ms-win-core-debug-l1-1-0.dll' />
9 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-errorhandling-l1-1-0.dll' Name='api-ms-win-core-errorhandling-l1-1-0.dll' />
10 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-file-l1-1-0.dll' Name='api-ms-win-core-file-l1-1-0.dll' />
11 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-file-l1-2-0.dll' Name='api-ms-win-core-file-l1-2-0.dll' />
12 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-file-l2-1-0.dll' Name='api-ms-win-core-file-l2-1-0.dll' />
13 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-handle-l1-1-0.dll' Name='api-ms-win-core-handle-l1-1-0.dll' />
14 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-heap-l1-1-0.dll' Name='api-ms-win-core-heap-l1-1-0.dll' />
15 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-interlocked-l1-1-0.dll' Name='api-ms-win-core-interlocked-l1-1-0.dll' />
16 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-libraryloader-l1-1-0.dll' Name='api-ms-win-core-libraryloader-l1-1-0.dll' />
17 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-localization-l1-2-0.dll' Name='api-ms-win-core-localization-l1-2-0.dll' />
18 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-memory-l1-1-0.dll' Name='api-ms-win-core-memory-l1-1-0.dll' />
19 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-namedpipe-l1-1-0.dll' Name='api-ms-win-core-namedpipe-l1-1-0.dll' />
20 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-processenvironment-l1-1-0.dll' Name='api-ms-win-core-processenvironment-l1-1-0.dll' />
21 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-processthreads-l1-1-0.dll' Name='api-ms-win-core-processthreads-l1-1-0.dll' />
22 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-processthreads-l1-1-1.dll' Name='api-ms-win-core-processthreads-l1-1-1.dll' />
23 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-profile-l1-1-0.dll' Name='api-ms-win-core-profile-l1-1-0.dll' />
24 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-rtlsupport-l1-1-0.dll' Name='api-ms-win-core-rtlsupport-l1-1-0.dll' />
25 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-string-l1-1-0.dll' Name='api-ms-win-core-string-l1-1-0.dll' />
26 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-synch-l1-1-0.dll' Name='api-ms-win-core-synch-l1-1-0.dll' />
27 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-synch-l1-2-0.dll' Name='api-ms-win-core-synch-l1-2-0.dll' />
28 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-sysinfo-l1-1-0.dll' Name='api-ms-win-core-sysinfo-l1-1-0.dll' />
29 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-timezone-l1-1-0.dll' Name='api-ms-win-core-timezone-l1-1-0.dll' />
30 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-core-util-l1-1-0.dll' Name='api-ms-win-core-util-l1-1-0.dll' />
31 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\API-MS-Win-core-xstate-l2-1-0.dll' Name='API-MS-Win-core-xstate-l2-1-0.dll' />
32 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-crt-conio-l1-1-0.dll' Name='api-ms-win-crt-conio-l1-1-0.dll' />
33 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-crt-convert-l1-1-0.dll' Name='api-ms-win-crt-convert-l1-1-0.dll' />
34 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-crt-environment-l1-1-0.dll' Name='api-ms-win-crt-environment-l1-1-0.dll' />
35 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-crt-filesystem-l1-1-0.dll' Name='api-ms-win-crt-filesystem-l1-1-0.dll' />
36 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-crt-heap-l1-1-0.dll' Name='api-ms-win-crt-heap-l1-1-0.dll' />
37 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-crt-locale-l1-1-0.dll' Name='api-ms-win-crt-locale-l1-1-0.dll' />
38 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-crt-math-l1-1-0.dll' Name='api-ms-win-crt-math-l1-1-0.dll' />
39 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-crt-multibyte-l1-1-0.dll' Name='api-ms-win-crt-multibyte-l1-1-0.dll' />
40 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-crt-private-l1-1-0.dll' Name='api-ms-win-crt-private-l1-1-0.dll' />
41 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-crt-process-l1-1-0.dll' Name='api-ms-win-crt-process-l1-1-0.dll' />
42 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-crt-runtime-l1-1-0.dll' Name='api-ms-win-crt-runtime-l1-1-0.dll' />
43 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-crt-stdio-l1-1-0.dll' Name='api-ms-win-crt-stdio-l1-1-0.dll' />
44 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-crt-string-l1-1-0.dll' Name='api-ms-win-crt-string-l1-1-0.dll' />
45 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-crt-time-l1-1-0.dll' Name='api-ms-win-crt-time-l1-1-0.dll' />
46 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\api-ms-win-crt-utility-l1-1-0.dll' Name='api-ms-win-crt-utility-l1-1-0.dll' />
47 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\clrcompression.dll' Name='clrcompression.dll' />
48 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\clretwrc.dll' Name='clretwrc.dll' />
49 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\clrjit.dll' Name='clrjit.dll' />
50 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\coreclr.dll' Name='coreclr.dll' />
51 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\dbgshim.dll' Name='dbgshim.dll' />
52 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\Example.LatestCoreMBA.deps.json' Name='Example.LatestCoreMBA.deps.json' />
53 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\Example.LatestCoreMBA.dll' Name='Example.LatestCoreMBA.dll' bal:BAFactoryAssembly='yes' />
54 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\Example.LatestCoreMBA.pdb' Name='Example.LatestCoreMBA.pdb' />
55 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\Example.LatestCoreMBA.runtimeconfig.json' Name='Example.LatestCoreMBA.runtimeconfig.json' />
56 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\hostfxr.dll' Name='hostfxr.dll' />
57 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\hostpolicy.dll' Name='hostpolicy.dll' />
58 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\mbanative.dll' Name='mbanative.dll' />
59 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\Microsoft.DiaSymReader.Native.x86.dll' Name='Microsoft.DiaSymReader.Native.x86.dll' />
60 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\Microsoft.Win32.Primitives.dll' Name='Microsoft.Win32.Primitives.dll' />
61 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\mscordaccore.dll' Name='mscordaccore.dll' />
62 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\mscordaccore_x86_x86_4.700.19.60701.dll' Name='mscordaccore_x86_x86_4.700.19.60701.dll' />
63 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\mscordbi.dll' Name='mscordbi.dll' />
64 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\mscorrc.debug.dll' Name='mscorrc.debug.dll' />
65 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\mscorrc.dll' Name='mscorrc.dll' />
66 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\SOS_README.md' Name='SOS_README.md' />
67 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Collections.Concurrent.dll' Name='System.Collections.Concurrent.dll' />
68 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Collections.dll' Name='System.Collections.dll' />
69 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Collections.NonGeneric.dll' Name='System.Collections.NonGeneric.dll' />
70 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Collections.Specialized.dll' Name='System.Collections.Specialized.dll' />
71 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Diagnostics.DiagnosticSource.dll' Name='System.Diagnostics.DiagnosticSource.dll' />
72 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Diagnostics.StackTrace.dll' Name='System.Diagnostics.StackTrace.dll' />
73 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Diagnostics.Tools.dll' Name='System.Diagnostics.Tools.dll' />
74 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.IO.Compression.Brotli.dll' Name='System.IO.Compression.Brotli.dll' />
75 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.IO.Compression.dll' Name='System.IO.Compression.dll' />
76 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.IO.FileSystem.dll' Name='System.IO.FileSystem.dll' />
77 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Linq.dll' Name='System.Linq.dll' />
78 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Net.Http.dll' Name='System.Net.Http.dll' />
79 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Net.NameResolution.dll' Name='System.Net.NameResolution.dll' />
80 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Net.NetworkInformation.dll' Name='System.Net.NetworkInformation.dll' />
81 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Net.Primitives.dll' Name='System.Net.Primitives.dll' />
82 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Net.Requests.dll' Name='System.Net.Requests.dll' />
83 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Net.Security.dll' Name='System.Net.Security.dll' />
84 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Net.ServicePoint.dll' Name='System.Net.ServicePoint.dll' />
85 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Net.Sockets.dll' Name='System.Net.Sockets.dll' />
86 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Net.WebHeaderCollection.dll' Name='System.Net.WebHeaderCollection.dll' />
87 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.ObjectModel.dll' Name='System.ObjectModel.dll' />
88 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Private.CoreLib.dll' Name='System.Private.CoreLib.dll' />
89 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Private.Uri.dll' Name='System.Private.Uri.dll' />
90 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Private.Xml.dll' Name='System.Private.Xml.dll' />
91 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Private.Xml.Linq.dll' Name='System.Private.Xml.Linq.dll' />
92 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Reflection.Metadata.dll' Name='System.Reflection.Metadata.dll' />
93 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Runtime.CompilerServices.Unsafe.dll' Name='System.Runtime.CompilerServices.Unsafe.dll' />
94 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Runtime.dll' Name='System.Runtime.dll' />
95 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Runtime.Extensions.dll' Name='System.Runtime.Extensions.dll' />
96 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Runtime.Loader.dll' Name='System.Runtime.Loader.dll' />
97 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Runtime.Numerics.dll' Name='System.Runtime.Numerics.dll' />
98 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Runtime.Serialization.Formatters.dll' Name='System.Runtime.Serialization.Formatters.dll' />
99 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Security.Claims.dll' Name='System.Security.Claims.dll' />
100 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Security.Cryptography.Algorithms.dll' Name='System.Security.Cryptography.Algorithms.dll' />
101 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Security.Cryptography.Cng.dll' Name='System.Security.Cryptography.Cng.dll' />
102 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Security.Cryptography.Csp.dll' Name='System.Security.Cryptography.Csp.dll' />
103 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Security.Cryptography.Encoding.dll' Name='System.Security.Cryptography.Encoding.dll' />
104 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Security.Cryptography.Primitives.dll' Name='System.Security.Cryptography.Primitives.dll' />
105 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Security.Cryptography.X509Certificates.dll' Name='System.Security.Cryptography.X509Certificates.dll' />
106 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Security.Principal.dll' Name='System.Security.Principal.dll' />
107 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Security.Principal.Windows.dll' Name='System.Security.Principal.Windows.dll' />
108 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\System.Text.RegularExpressions.dll' Name='System.Text.RegularExpressions.dll' />
109 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\ucrtbase.dll' Name='ucrtbase.dll' />
110 <Payload SourceFile='publish\Example.LatestCoreMBA\trimmedscd\WixToolset.Mba.Core.dll' Name='WixToolset.Mba.Core.dll' />
111 </PayloadGroup>
112 </Fragment>
113</Wix> \ No newline at end of file
diff --git a/src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/SelfContainedBundle.wxs b/src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/SelfContainedBundle.wxs
new file mode 100644
index 00000000..015cc099
--- /dev/null
+++ b/src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/SelfContainedBundle.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="SCDLatestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533">
5 <BootstrapperApplicationRef Id="DotNetCoreBootstrapperApplicationHost">
6 <PayloadGroupRef Id="publish.Example.LatestCoreMBA.scd" />
7 </BootstrapperApplicationRef>
8 <Chain>
9 <ExePackage SourceFile="c:\windows\system32\kernel32.dll" PerMachine="yes" />
10 </Chain>
11 </Bundle>
12</Wix>
diff --git a/src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/TrimmedSelfContainedBundle.wxs b/src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/TrimmedSelfContainedBundle.wxs
new file mode 100644
index 00000000..39e850a8
--- /dev/null
+++ b/src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/TrimmedSelfContainedBundle.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="TrimmedSCDLatestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533">
5 <BootstrapperApplicationRef Id="DotNetCoreBootstrapperApplicationHost">
6 <PayloadGroupRef Id="publish.Example.LatestCoreMBA.trimmedscd" />
7 </BootstrapperApplicationRef>
8 <Chain>
9 <ExePackage SourceFile="c:\windows\system32\kernel32.dll" PerMachine="yes" />
10 </Chain>
11 </Bundle>
12</Wix>
diff --git a/src/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj b/src/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj
index 5026af85..1ea4522b 100644
--- a/src/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj
+++ b/src/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj
@@ -11,9 +11,23 @@
11 <NoWarn>NU1701</NoWarn> 11 <NoWarn>NU1701</NoWarn>
12 </PropertyGroup> 12 </PropertyGroup>
13 13
14 <PropertyGroup>
15 <EarliestCoreMBAProjectPath>..\examples\EarliestCoreMBA\Example.EarliestCoreMBA.csproj</EarliestCoreMBAProjectPath>
16 <LatestCoreMBAProjectPath>..\examples\LatestCoreMBA\Example.LatestCoreMBA.csproj</LatestCoreMBAProjectPath>
17 <MBAPublishPath>$(OutputPath)examples\publish\</MBAPublishPath>
18 </PropertyGroup>
19
14 <ItemGroup> 20 <ItemGroup>
21 <Content Include="TestData\EarliestCoreMBA\HarvestedSCD.wxs" CopyToOutputDirectory="PreserveNewest"/>
22 <Content Include="TestData\EarliestCoreMBA\HarvestedTrimmedSCD.wxs" CopyToOutputDirectory="PreserveNewest"/>
23 <Content Include="TestData\EarliestCoreMBA\SelfContainedBundle.wxs" CopyToOutputDirectory="PreserveNewest"/>
24 <Content Include="TestData\EarliestCoreMBA\TrimmedSelfContainedBundle.wxs" CopyToOutputDirectory="PreserveNewest"/>
15 <Content Include="TestData\FullFramework2MBA\Bundle.wxs" CopyToOutputDirectory="PreserveNewest"/> 25 <Content Include="TestData\FullFramework2MBA\Bundle.wxs" CopyToOutputDirectory="PreserveNewest"/>
16 <Content Include="TestData\FullFramework4MBA\Bundle.wxs" CopyToOutputDirectory="PreserveNewest"/> 26 <Content Include="TestData\FullFramework4MBA\Bundle.wxs" CopyToOutputDirectory="PreserveNewest"/>
27 <Content Include="TestData\LatestCoreMBA\HarvestedSCD.wxs" CopyToOutputDirectory="PreserveNewest"/>
28 <Content Include="TestData\LatestCoreMBA\HarvestedTrimmedSCD.wxs" CopyToOutputDirectory="PreserveNewest"/>
29 <Content Include="TestData\LatestCoreMBA\SelfContainedBundle.wxs" CopyToOutputDirectory="PreserveNewest"/>
30 <Content Include="TestData\LatestCoreMBA\TrimmedSelfContainedBundle.wxs" CopyToOutputDirectory="PreserveNewest"/>
17 </ItemGroup> 31 </ItemGroup>
18 32
19 <Target Name="CopyExtensions" AfterTargets="Build"> 33 <Target Name="CopyExtensions" AfterTargets="Build">
@@ -21,6 +35,17 @@
21 </Target> 35 </Target>
22 36
23 <ItemGroup> 37 <ItemGroup>
38 <CoreMBAProject Include="$(EarliestCoreMBAProjectPath)">
39 <PublishPath>$(MBAPublishPath)Example.EarliestCoreMBA</PublishPath>
40 </CoreMBAProject>
41 <CoreMBAProject Include="$(LatestCoreMBAProjectPath)">
42 <PublishPath>$(MBAPublishPath)Example.LatestCoreMBA</PublishPath>
43 </CoreMBAProject>
44 </ItemGroup>
45
46 <ItemGroup>
47 <ProjectReference Include="$(EarliestCoreMBAProjectPath)" />
48 <ProjectReference Include="$(LatestCoreMBAProjectPath)" />
24 <ProjectReference Include="..\examples\FullFramework2MBA\Example.FullFramework2MBA.csproj" /> 49 <ProjectReference Include="..\examples\FullFramework2MBA\Example.FullFramework2MBA.csproj" />
25 <ProjectReference Include="..\examples\FullFramework4MBA\Example.FullFramework4MBA.csproj" /> 50 <ProjectReference Include="..\examples\FullFramework4MBA\Example.FullFramework4MBA.csproj" />
26 <ProjectReference Include="..\examples\TestEngine\Example.TestEngine.vcxproj" /> 51 <ProjectReference Include="..\examples\TestEngine\Example.TestEngine.vcxproj" />
@@ -40,4 +65,9 @@
40 <PackageReference Include="xunit" Version="2.4.1" /> 65 <PackageReference Include="xunit" Version="2.4.1" />
41 <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" /> 66 <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="All" />
42 </ItemGroup> 67 </ItemGroup>
68
69 <Target Name="PublishExamples" AfterTargets="Build">
70 <Exec Command='dotnet publish -o "%(CoreMBAProject.PublishPath)\scd" -r win-x86 -c $(Configuration) --self-contained true "%(CoreMBAProject.Identity)"' />
71 <Exec Command='dotnet publish -o "%(CoreMBAProject.PublishPath)\trimmedscd" -r win-x86 -c $(Configuration) --self-contained true -p:PublishTrimmed=true "%(CoreMBAProject.Identity)"' />
72 </Target>
43</Project> 73</Project>
diff --git a/src/test/examples/EarliestCoreMBA/EarliestCoreBA.cs b/src/test/examples/EarliestCoreMBA/EarliestCoreBA.cs
new file mode 100644
index 00000000..c9291a7f
--- /dev/null
+++ b/src/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
3namespace 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/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs b/src/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs
new file mode 100644
index 00000000..672e17ee
--- /dev/null
+++ b/src/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))]
4namespace 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/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj b/src/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj
new file mode 100644
index 00000000..326633ba
--- /dev/null
+++ b/src/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj
@@ -0,0 +1,18 @@
1<Project Sdk="Microsoft.NET.Sdk">
2
3 <PropertyGroup>
4 <TargetFramework>netcoreapp3.0</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="2.1.65" PrivateAssets="all" />
16 <PackageReference Include="WixToolset.Mba.Core" Version="4.0.19" />
17 </ItemGroup>
18</Project> \ No newline at end of file
diff --git a/src/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj b/src/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj
new file mode 100644
index 00000000..1d325b1b
--- /dev/null
+++ b/src/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj
@@ -0,0 +1,23 @@
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>Latest .NET Core MBA</Description>
8 </PropertyGroup>
9
10 <PropertyGroup Condition="'$(PublishTrimmed)'=='true'">
11 <PublishReadyToRunShowWarnings>false</PublishReadyToRunShowWarnings>
12 <PublishReadyToRun>true</PublishReadyToRun>
13 </PropertyGroup>
14
15 <ItemGroup>
16 <TrimmerRootAssembly Include="System.Runtime.Loader" />
17 </ItemGroup>
18
19 <ItemGroup>
20 <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" />
21 <PackageReference Include="WixToolset.Mba.Core" Version="4.0.19" />
22 </ItemGroup>
23</Project> \ No newline at end of file
diff --git a/src/test/examples/LatestCoreMBA/LatestCoreBA.cs b/src/test/examples/LatestCoreMBA/LatestCoreBA.cs
new file mode 100644
index 00000000..50386a87
--- /dev/null
+++ b/src/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
3namespace 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/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs b/src/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs
new file mode 100644
index 00000000..fff3b5c5
--- /dev/null
+++ b/src/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))]
4namespace 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/test/examples/TestEngine/TestEngine.cpp b/src/test/examples/TestEngine/TestEngine.cpp
index 203df115..f0811e0a 100644
--- a/src/test/examples/TestEngine/TestEngine.cpp
+++ b/src/test/examples/TestEngine/TestEngine.cpp
@@ -35,6 +35,12 @@ HRESULT TestEngine::LoadBA(
35 35
36 command.cbSize = sizeof(BOOTSTRAPPER_COMMAND); 36 command.cbSize = sizeof(BOOTSTRAPPER_COMMAND);
37 37
38 hr = PathGetDirectory(wzBAFilePath, &command.wzBootstrapperWorkingFolder);
39 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to allocate wzBootstrapperWorkingFolder");
40
41 hr = PathConcat(command.wzBootstrapperWorkingFolder, L"BootstrapperApplicationData.xml", &command.wzBootstrapperApplicationDataPath);
42 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to allocate wzBootstrapperApplicationDataPath");
43
38 args.cbSize = sizeof(BOOTSTRAPPER_CREATE_ARGS); 44 args.cbSize = sizeof(BOOTSTRAPPER_CREATE_ARGS);
39 args.pCommand = &command; 45 args.pCommand = &command;
40 args.pfnBootstrapperEngineProc = TestEngine::EngineProc; 46 args.pfnBootstrapperEngineProc = TestEngine::EngineProc;
@@ -53,6 +59,9 @@ HRESULT TestEngine::LoadBA(
53 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure on BootstrapperApplicationCreate."); 59 ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure on BootstrapperApplicationCreate.");
54 60
55LExit: 61LExit:
62 ReleaseStr(command.wzBootstrapperApplicationDataPath);
63 ReleaseStr(command.wzBootstrapperWorkingFolder);
64
56 return hr; 65 return hr;
57} 66}
58 67
@@ -92,6 +101,7 @@ HRESULT TestEngine::SendStartupEvent()
92void TestEngine::UnloadBA() 101void TestEngine::UnloadBA()
93{ 102{
94 PFN_BOOTSTRAPPER_APPLICATION_DESTROY pfnDestroy = NULL; 103 PFN_BOOTSTRAPPER_APPLICATION_DESTROY pfnDestroy = NULL;
104 BOOL fDisableUnloading = m_pCreateResults && m_pCreateResults->fDisableUnloading;
95 105
96 ReleaseNullMem(m_pCreateResults); 106 ReleaseNullMem(m_pCreateResults);
97 107
@@ -104,7 +114,11 @@ void TestEngine::UnloadBA()
104 114
105 if (m_hBAModule) 115 if (m_hBAModule)
106 { 116 {
107 ::FreeLibrary(m_hBAModule); 117 if (!fDisableUnloading)
118 {
119 ::FreeLibrary(m_hBAModule);
120 }
121
108 m_hBAModule = NULL; 122 m_hBAModule = NULL;
109 } 123 }
110} 124}
diff --git a/src/test/examples/TestEngine/precomp.h b/src/test/examples/TestEngine/precomp.h
index 0d2afb06..3fbc7e90 100644
--- a/src/test/examples/TestEngine/precomp.h
+++ b/src/test/examples/TestEngine/precomp.h
@@ -9,6 +9,7 @@
9#include "logutil.h" 9#include "logutil.h"
10#include "memutil.h" 10#include "memutil.h"
11#include "pathutil.h" 11#include "pathutil.h"
12#include "strutil.h"
12 13
13#include "BootstrapperEngine.h" 14#include "BootstrapperEngine.h"
14#include "BootstrapperApplication.h" 15#include "BootstrapperApplication.h"
diff --git a/src/wixext/BalCompiler.cs b/src/wixext/BalCompiler.cs
index da32234c..33400f3b 100644
--- a/src/wixext/BalCompiler.cs
+++ b/src/wixext/BalCompiler.cs
@@ -197,6 +197,15 @@ namespace WixToolset.Bal
197 { 197 {
198 switch (attribute.Name.LocalName) 198 switch (attribute.Name.LocalName)
199 { 199 {
200 case "BAFactoryAssembly":
201 if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute))
202 {
203 section.AddTuple(new WixBalBAFactoryAssemblyTuple(sourceLineNumbers)
204 {
205 PayloadId = payloadId,
206 });
207 }
208 break;
200 case "BAFunctions": 209 case "BAFunctions":
201 if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute)) 210 if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute))
202 { 211 {
diff --git a/src/wixext/Tuples/BalTupleDefinitions.cs b/src/wixext/Tuples/BalTupleDefinitions.cs
index 676db9f6..48199f95 100644
--- a/src/wixext/Tuples/BalTupleDefinitions.cs
+++ b/src/wixext/Tuples/BalTupleDefinitions.cs
@@ -4,9 +4,11 @@ namespace WixToolset.Bal
4{ 4{
5 using System; 5 using System;
6 using WixToolset.Data; 6 using WixToolset.Data;
7 using WixToolset.Data.Burn;
7 8
8 public enum BalTupleDefinitionType 9 public enum BalTupleDefinitionType
9 { 10 {
11 WixBalBAFactoryAssembly,
10 WixBalBAFunctions, 12 WixBalBAFunctions,
11 WixBalCondition, 13 WixBalCondition,
12 WixMbaPrereqInformation, 14 WixMbaPrereqInformation,
@@ -32,6 +34,9 @@ namespace WixToolset.Bal
32 { 34 {
33 switch (type) 35 switch (type)
34 { 36 {
37 case BalTupleDefinitionType.WixBalBAFactoryAssembly:
38 return BalTupleDefinitions.WixBalBAFactoryAssembly;
39
35 case BalTupleDefinitionType.WixBalBAFunctions: 40 case BalTupleDefinitionType.WixBalBAFunctions:
36 return BalTupleDefinitions.WixBalBAFunctions; 41 return BalTupleDefinitions.WixBalBAFunctions;
37 42
@@ -51,5 +56,15 @@ namespace WixToolset.Bal
51 throw new ArgumentOutOfRangeException(nameof(type)); 56 throw new ArgumentOutOfRangeException(nameof(type));
52 } 57 }
53 } 58 }
59
60 static BalTupleDefinitions()
61 {
62 WixBalBAFactoryAssembly.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag);
63 WixBalBAFunctions.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag);
64 WixBalCondition.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag);
65 WixMbaPrereqInformation.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag);
66 WixStdbaOptions.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag);
67 WixStdbaOverridableVariable.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag);
68 }
54 } 69 }
55} 70}
diff --git a/src/wixext/Tuples/WixBalBAFactoryAssemblyTuple.cs b/src/wixext/Tuples/WixBalBAFactoryAssemblyTuple.cs
new file mode 100644
index 00000000..e33ea562
--- /dev/null
+++ b/src/wixext/Tuples/WixBalBAFactoryAssemblyTuple.cs
@@ -0,0 +1,47 @@
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
3namespace WixToolset.Bal
4{
5 using WixToolset.Data;
6 using WixToolset.Bal.Tuples;
7
8 public static partial class BalTupleDefinitions
9 {
10 public static readonly IntermediateTupleDefinition WixBalBAFactoryAssembly = new IntermediateTupleDefinition(
11 BalTupleDefinitionType.WixBalBAFactoryAssembly.ToString(),
12 new[]
13 {
14 new IntermediateFieldDefinition(nameof(WixBalBAFactoryTupleFields.PayloadId), IntermediateFieldType.String),
15 },
16 typeof(WixBalBAFactoryAssemblyTuple));
17 }
18}
19
20namespace WixToolset.Bal.Tuples
21{
22 using WixToolset.Data;
23
24 public enum WixBalBAFactoryTupleFields
25 {
26 PayloadId,
27 }
28
29 public class WixBalBAFactoryAssemblyTuple : IntermediateTuple
30 {
31 public WixBalBAFactoryAssemblyTuple() : base(BalTupleDefinitions.WixBalBAFactoryAssembly, null, null)
32 {
33 }
34
35 public WixBalBAFactoryAssemblyTuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base(BalTupleDefinitions.WixBalBAFactoryAssembly, sourceLineNumber, id)
36 {
37 }
38
39 public IntermediateField this[WixBalBAFactoryTupleFields index] => this.Fields[(int)index];
40
41 public string PayloadId
42 {
43 get => this.Fields[(int)WixBalBAFactoryTupleFields.PayloadId].AsString();
44 set => this.Set((int)WixBalBAFactoryTupleFields.PayloadId, value);
45 }
46 }
47} \ No newline at end of file
diff --git a/src/wixext/bal.xsd b/src/wixext/bal.xsd
index 3081a279..52f9142f 100644
--- a/src/wixext/bal.xsd
+++ b/src/wixext/bal.xsd
@@ -9,7 +9,7 @@
9 xmlns="http://wixtoolset.org/schemas/v4/wxs/bal"> 9 xmlns="http://wixtoolset.org/schemas/v4/wxs/bal">
10 <xs:annotation> 10 <xs:annotation>
11 <xs:documentation> 11 <xs:documentation>
12 The source code schema for the WiX Toolset Burn User Experience Extension. 12 The source code schema for the WiX Toolset Bootstrapper Application Layer Extension.
13 </xs:documentation> 13 </xs:documentation>
14 </xs:annotation> 14 </xs:annotation>
15 15
@@ -215,10 +215,25 @@
215 </xs:complexType> 215 </xs:complexType>
216 </xs:element> 216 </xs:element>
217 217
218 <xs:attribute name="BAFactoryAssembly" type="YesNoType">
219 <xs:annotation>
220 <xs:documentation>
221 When set to "yes", DotNetCoreBootstrapperApplicationHost will load the DLL and instantiate the type with the BootstrapperApplicationFactoryAttribute.
222 There must be corresponding deps.json and runtimeconfig.json files (set EnableDynamicLoading to True in the .NET Core project).
223 The .NET Core project must have been published, not just built.
224 Only one payload may be marked with this attribute set to "yes".
225 </xs:documentation>
226 <xs:appinfo>
227 <xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="Payload" />
228 </xs:appinfo>
229 </xs:annotation>
230 </xs:attribute>
231
218 <xs:attribute name="BAFunctions" type="YesNoType"> 232 <xs:attribute name="BAFunctions" type="YesNoType">
219 <xs:annotation> 233 <xs:annotation>
220 <xs:documentation> 234 <xs:documentation>
221 When set to "yes", WixStdBA will load the DLL and work with it to handle BA messages. 235 When set to "yes", WixStdBA will load the DLL and work with it to handle BA messages.
236 Only one payload may be marked with this attribute set to "yes".
222 </xs:documentation> 237 </xs:documentation>
223 <xs:appinfo> 238 <xs:appinfo>
224 <xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="Payload" /> 239 <xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="Payload" />
diff --git a/src/wixlib/Dnc.wxs b/src/wixlib/Dnc.wxs
new file mode 100644
index 00000000..65a59e61
--- /dev/null
+++ b/src/wixlib/Dnc.wxs
@@ -0,0 +1,21 @@
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<Wix xmlns='http://wixtoolset.org/schemas/v4/wxs'>
6 <!--
7 Dnc.wxs - .NET Core BA resources.
8 -->
9 <Fragment>
10 <BootstrapperApplication Id='DotNetCoreBootstrapperApplicationHost' SourceFile='dnchost.dll'>
11 <PayloadGroupRef Id='Dnc' />
12 </BootstrapperApplication>
13 </Fragment>
14
15 <Fragment>
16 <PayloadGroup Id='Dnc'>
17 <Payload Compressed='yes' SourceFile='nethost.dll' />
18 <Payload Compressed='yes' SourceFile='WixToolset.Dnc.Host.dll' />
19 </PayloadGroup>
20 </Fragment>
21</Wix>
diff --git a/src/wixlib/bal.wixproj b/src/wixlib/bal.wixproj
index c33375fe..a158cd81 100644
--- a/src/wixlib/bal.wixproj
+++ b/src/wixlib/bal.wixproj
@@ -14,6 +14,7 @@
14 14
15 <ItemGroup> 15 <ItemGroup>
16 <Compile Include="BalExtension.wxs" /> 16 <Compile Include="BalExtension.wxs" />
17 <Compile Include="Dnc.wxs" />
17 <Compile Include="Mba.wxs" /> 18 <Compile Include="Mba.wxs" />
18 <Compile Include="wixstdba.wxs" /> 19 <Compile Include="wixstdba.wxs" />
19 <Compile Include="wixstdba_x86.wxs" /> 20 <Compile Include="wixstdba_x86.wxs" />
@@ -33,6 +34,10 @@
33 </ItemGroup> 34 </ItemGroup>
34 35
35 <ItemGroup> 36 <ItemGroup>
37 <ProjectReference Include="..\dnchost\dnchost.vcxproj">
38 <Name>dnchost</Name>
39 <Project>{B6F70281-6583-4138-BB7F-AABFEBBB3CA2}</Project>
40 </ProjectReference>
36 <ProjectReference Include="..\mbahost\mbahost.vcxproj"> 41 <ProjectReference Include="..\mbahost\mbahost.vcxproj">
37 <Name>mbahost</Name> 42 <Name>mbahost</Name>
38 <Project>{12C87C77-3547-44F8-8134-29BC915CB19D}</Project> 43 <Project>{12C87C77-3547-44F8-8134-29BC915CB19D}</Project>