@joebigelow / wix / commits / a79ce0b9

Add support for FDD in DotNetCoreBootstrapperApplicationHost.

Sean Hall committed Apr 29, 2020 at 19:32 UTC a79ce0b907676e50332139b4c4a8acb5d22a4b46
17 files changed +415 -12
src/dnchost/dnchost.cpp
+31 -3
@@ -97,15 +97,22 @@ extern "C" HRESULT WINAPI BootstrapperApplicationCreate(
97 BalExitOnFailure(hr, "Failed to create the .NET Core bootstrapper application factory.");
98 }
99
100 - BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading .NET Core SCD bootstrapper application.");
100 + BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading .NET Core %ls bootstrapper application.", DNCHOSTTYPE_FDD == vstate.type ? L"FDD" : L"SCD");
101
102 hr = vstate.pAppFactory->Create(pArgs, pResults);
103 BalExitOnFailure(hr, "Failed to create the .NET Core bootstrapper application.");
104 }
105 else // fallback to the prerequisite BA.
106 {
107 - hrHostInitialization = E_DNCHOST_SCD_RUNTIME_FAILURE;
108 - BalLogError(hr, "The self-contained .NET Core runtime failed to load. This is an unrecoverable error.");
107 + if (DNCHOSTTYPE_SCD == vstate.type)
108 + {
109 + hrHostInitialization = E_DNCHOST_SCD_RUNTIME_FAILURE;
110 + BalLogError(hr, "The self-contained .NET Core runtime failed to load. This is an unrecoverable error.");
111 + }
112 + else
113 + {
114 + hrHostInitialization = S_OK;
115 + }
116 BalLog(BOOTSTRAPPER_LOG_LEVEL_STANDARD, "Loading prerequisite bootstrapper application because .NET Core host could not be loaded, error: 0x%08x.", hr);
117
118 hr = CreatePrerequisiteBA(hrHostInitialization, pEngine, vstate.sczAppBase, pArgs, pResults);
@@ -166,6 +173,7 @@ static HRESULT LoadDncConfiguration(
173 LPWSTR sczPayloadId = NULL;
174 LPWSTR sczPayloadXPath = NULL;
175 LPWSTR sczPayloadName = NULL;
176 + DWORD dwBool = 0;
177
178 hr = XmlLoadDocumentFromFile(pArgs->pCommand->wzBootstrapperApplicationDataPath, &pixdManifest);
179 BalExitOnFailure(hr, "Failed to load BalManifest '%ls'", pArgs->pCommand->wzBootstrapperApplicationDataPath);
@@ -220,6 +228,26 @@ static HRESULT LoadDncConfiguration(
228 hr = StrAllocConcat(&pState->sczBaFactoryRuntimeConfigPath, L".runtimeconfig.json", 0);
229 BalExitOnFailure(hr, "Failed to concat extension to runtime config path.");
230
231 + pState->type = DNCHOSTTYPE_FDD;
232 +
233 + hr = XmlSelectSingleNode(pixdManifest, L"/BootstrapperApplicationData/WixDncOptions", &pixnHost);
234 + if (S_FALSE == hr)
235 + {
236 + ExitFunction1(hr = S_OK);
237 + }
238 + BalExitOnFailure(hr, "Failed to find WixDncOptions element in bootstrapper application config.");
239 +
240 + hr = XmlGetAttributeNumber(pixnHost, L"SelfContainedDeployment", &dwBool);
241 + if (S_FALSE == hr)
242 + {
243 + hr = S_OK;
244 + }
245 + else if (SUCCEEDED(hr) && dwBool)
246 + {
247 + pState->type = DNCHOSTTYPE_SCD;
248 + }
249 + BalExitOnFailure(hr, "Failed to get SelfContainedDeployment value.");
250 +
251 LExit:
252 ReleaseStr(sczPayloadName);
253 ReleaseObject(pixnPayload);
src/dnchost/dnchost.h
+8
@@ -2,6 +2,13 @@
2 // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
3
4
5 +enum DNCHOSTTYPE
6 +{
7 + DNCHOSTTYPE_UNKNOWN,
8 + DNCHOSTTYPE_FDD,
9 + DNCHOSTTYPE_SCD,
10 +};
11 +
12 extern "C" typedef HRESULT(WINAPI* PFN_DNCPREQ_BOOTSTRAPPER_APPLICATION_CREATE)(
13 __in HRESULT hrHostInitialization,
14 __in IBootstrapperEngine* pEngine,
@@ -21,6 +28,7 @@ struct DNCSTATE
28 LPWSTR sczBaFactoryAssemblyPath;
29 LPWSTR sczBaFactoryDepsJsonPath;
30 LPWSTR sczBaFactoryRuntimeConfigPath;
31 + DNCHOSTTYPE type;
32 HOSTFXR_STATE hostfxrState;
33 IBootstrapperApplicationFactory* pAppFactory;
34 HMODULE hMbapreqModule;
src/test/WixToolsetTest.ManagedHost/DncHostFixture.cs
+107
@@ -9,6 +9,40 @@ namespace WixToolsetTest.ManagedHost
9
10 public class DncHostFixture
11 {
12 + [Fact]
13 + public void CanLoadFDDEarliestCoreMBA()
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, "FDDEarliestCoreMBA.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, "FrameworkDependentBundle.wxs"),
28 + "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
29 + "-intermediateFolder", intermediateFolder,
30 + "-bindpath", baSourceFolder,
31 + "-burnStub", TestEngine.BurnStubFile,
32 + "-o", bundleFile,
33 + });
34 + compileResult.AssertSuccess();
35 + var testEngine = new TestEngine();
36 +
37 + var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
38 + var logMessages = result.Output;
39 + Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[0]);
40 + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]);
41 + Assert.Equal("EarliestCoreBA", logMessages[2]);
42 + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]);
43 + }
44 + }
45 +
46 [Fact]
47 public void CanLoadSCDEarliestCoreMBA()
48 {
@@ -119,6 +153,79 @@ namespace WixToolsetTest.ManagedHost
153 }
154 }
155
156 + [Fact]
157 + public void CanLoadFDDLatestCoreMBA()
158 + {
159 + using (var fs = new DisposableFileSystem())
160 + {
161 + var baseFolder = fs.GetFolder();
162 + var binFolder = Path.Combine(baseFolder, "bin");
163 + var bundleFile = Path.Combine(binFolder, "FDDLatestCoreMBA.exe");
164 + var baSourceFolder = TestData.Get(@"..\examples");
165 + var bundleSourceFolder = TestData.Get(@"TestData\LatestCoreMBA");
166 + var intermediateFolder = Path.Combine(baseFolder, "obj");
167 +
168 + var compileResult = WixRunner.Execute(new[]
169 + {
170 + "build",
171 + Path.Combine(bundleSourceFolder, "FrameworkDependentBundle.wxs"),
172 + "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
173 + "-intermediateFolder", intermediateFolder,
174 + "-bindpath", baSourceFolder,
175 + "-burnStub", TestEngine.BurnStubFile,
176 + "-o", bundleFile,
177 + });
178 + compileResult.AssertSuccess();
179 + var testEngine = new TestEngine();
180 +
181 + var result = testEngine.RunShutdownEngine(bundleFile, baseFolder);
182 + var logMessages = result.Output;
183 + Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[0]);
184 + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]);
185 + Assert.Equal("LatestCoreBA", logMessages[2]);
186 + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]);
187 + }
188 + }
189 +
190 + [Fact]
191 + public void CanReloadFDDLatestCoreMBA()
192 + {
193 + using (var fs = new DisposableFileSystem())
194 + {
195 + var baseFolder = fs.GetFolder();
196 + var binFolder = Path.Combine(baseFolder, "bin");
197 + var bundleFile = Path.Combine(binFolder, "FDDLatestCoreMBA.exe");
198 + var baSourceFolder = TestData.Get(@"..\examples");
199 + var bundleSourceFolder = TestData.Get(@"TestData\LatestCoreMBA");
200 + var intermediateFolder = Path.Combine(baseFolder, "obj");
201 +
202 + var compileResult = WixRunner.Execute(new[]
203 + {
204 + "build",
205 + Path.Combine(bundleSourceFolder, "FrameworkDependentBundle.wxs"),
206 + "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
207 + "-intermediateFolder", intermediateFolder,
208 + "-bindpath", baSourceFolder,
209 + "-burnStub", TestEngine.BurnStubFile,
210 + "-o", bundleFile,
211 + });
212 + compileResult.AssertSuccess();
213 + var testEngine = new TestEngine();
214 +
215 + var result = testEngine.RunReloadEngine(bundleFile, baseFolder);
216 + var logMessages = result.Output;
217 + Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[0]);
218 + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]);
219 + Assert.Equal("LatestCoreBA", logMessages[2]);
220 + Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]);
221 + Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[4]);
222 + Assert.Equal("Reloaded 1 time(s)", logMessages[5]); // dnchost doesn't currently support unloading
223 + Assert.Equal("Creating BA thread to run asynchronously.", logMessages[6]);
224 + Assert.Equal("LatestCoreBA", logMessages[7]);
225 + Assert.Equal("Shutdown,Restart,0", logMessages[8]);
226 + }
227 + }
228 +
229 [Fact]
230 public void CanLoadSCDLatestCoreMBA()
231 {
src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/FrameworkDependentBundle.wxs new
+17
@@ -0,0 +1,17 @@
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="FDDEarliestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533">
5 + <BootstrapperApplicationRef Id="DotNetCoreBootstrapperApplicationHost">
6 + <Payload SourceFile='publish\Example.EarliestCoreMBA\fdd\Example.EarliestCoreMBA.deps.json' Name='Example.EarliestCoreMBA.deps.json' />
7 + <Payload SourceFile='publish\Example.EarliestCoreMBA\fdd\Example.EarliestCoreMBA.dll' Name='Example.EarliestCoreMBA.dll' bal:BAFactoryAssembly='yes' />
8 + <Payload SourceFile='publish\Example.EarliestCoreMBA\fdd\Example.EarliestCoreMBA.pdb' Name='Example.EarliestCoreMBA.pdb' />
9 + <Payload SourceFile='publish\Example.EarliestCoreMBA\fdd\Example.EarliestCoreMBA.runtimeconfig.json' Name='Example.EarliestCoreMBA.runtimeconfig.json' />
10 + <Payload SourceFile='publish\Example.EarliestCoreMBA\fdd\mbanative.dll' Name='mbanative.dll' />
11 + <Payload SourceFile='publish\Example.EarliestCoreMBA\fdd\WixToolset.Mba.Core.dll' Name='WixToolset.Mba.Core.dll' />
12 + </BootstrapperApplicationRef>
13 + <Chain>
14 + <ExePackage SourceFile="c:\windows\system32\kernel32.dll" bal:PrereqPackage="yes" />
15 + </Chain>
16 + </Bundle>
17 +</Wix>
src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/SelfContainedBundle.wxs
+1
@@ -3,6 +3,7 @@
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 + <bal:WixDotNetCoreBootstrapperApplication SelfContainedDeployment="yes" />
7 <PayloadGroupRef Id="publish.Example.EarliestCoreMBA.scd" />
8 </BootstrapperApplicationRef>
9 <Chain>
src/test/WixToolsetTest.ManagedHost/TestData/EarliestCoreMBA/TrimmedSelfContainedBundle.wxs
+1
@@ -3,6 +3,7 @@
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 + <bal:WixDotNetCoreBootstrapperApplication SelfContainedDeployment="yes" />
7 <PayloadGroupRef Id="publish.Example.EarliestCoreMBA.trimmedscd" />
8 </BootstrapperApplicationRef>
9 <Chain>
src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/FrameworkDependentBundle.wxs new
+17
@@ -0,0 +1,17 @@
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="FDDLatestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533">
5 + <BootstrapperApplicationRef Id="DotNetCoreBootstrapperApplicationHost">
6 + <Payload SourceFile='publish\Example.LatestCoreMBA\fdd\Example.LatestCoreMBA.deps.json' Name='Example.LatestCoreMBA.deps.json' />
7 + <Payload SourceFile='publish\Example.LatestCoreMBA\fdd\Example.LatestCoreMBA.dll' Name='Example.LatestCoreMBA.dll' bal:BAFactoryAssembly='yes' />
8 + <Payload SourceFile='publish\Example.LatestCoreMBA\fdd\Example.LatestCoreMBA.pdb' Name='Example.LatestCoreMBA.pdb' />
9 + <Payload SourceFile='publish\Example.LatestCoreMBA\fdd\Example.LatestCoreMBA.runtimeconfig.json' Name='Example.LatestCoreMBA.runtimeconfig.json' />
10 + <Payload SourceFile='publish\Example.LatestCoreMBA\fdd\mbanative.dll' Name='mbanative.dll' />
11 + <Payload SourceFile='publish\Example.LatestCoreMBA\fdd\WixToolset.Mba.Core.dll' Name='WixToolset.Mba.Core.dll' />
12 + </BootstrapperApplicationRef>
13 + <Chain>
14 + <ExePackage SourceFile="c:\windows\system32\kernel32.dll" bal:PrereqPackage="yes" />
15 + </Chain>
16 + </Bundle>
17 +</Wix>
src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/SelfContainedBundle.wxs
+1
@@ -3,6 +3,7 @@
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 + <bal:WixDotNetCoreBootstrapperApplication SelfContainedDeployment="yes" />
7 <PayloadGroupRef Id="publish.Example.LatestCoreMBA.scd" />
8 </BootstrapperApplicationRef>
9 <Chain>
src/test/WixToolsetTest.ManagedHost/TestData/LatestCoreMBA/TrimmedSelfContainedBundle.wxs
+1
@@ -3,6 +3,7 @@
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 + <bal:WixDotNetCoreBootstrapperApplication SelfContainedDeployment="yes" />
7 <PayloadGroupRef Id="publish.Example.LatestCoreMBA.trimmedscd" />
8 </BootstrapperApplicationRef>
9 <Chain>
src/test/WixToolsetTest.ManagedHost/WixToolsetTest.ManagedHost.csproj
+3
@@ -18,12 +18,14 @@
18 </PropertyGroup>
19
20 <ItemGroup>
21 + <Content Include="TestData\EarliestCoreMBA\FrameworkDependentBundle.wxs" CopyToOutputDirectory="PreserveNewest"/>
22 <Content Include="TestData\EarliestCoreMBA\HarvestedSCD.wxs" CopyToOutputDirectory="PreserveNewest"/>
23 <Content Include="TestData\EarliestCoreMBA\HarvestedTrimmedSCD.wxs" CopyToOutputDirectory="PreserveNewest"/>
24 <Content Include="TestData\EarliestCoreMBA\SelfContainedBundle.wxs" CopyToOutputDirectory="PreserveNewest"/>
25 <Content Include="TestData\EarliestCoreMBA\TrimmedSelfContainedBundle.wxs" CopyToOutputDirectory="PreserveNewest"/>
26 <Content Include="TestData\FullFramework2MBA\Bundle.wxs" CopyToOutputDirectory="PreserveNewest"/>
27 <Content Include="TestData\FullFramework4MBA\Bundle.wxs" CopyToOutputDirectory="PreserveNewest"/>
28 + <Content Include="TestData\LatestCoreMBA\FrameworkDependentBundle.wxs" CopyToOutputDirectory="PreserveNewest"/>
29 <Content Include="TestData\LatestCoreMBA\HarvestedSCD.wxs" CopyToOutputDirectory="PreserveNewest"/>
30 <Content Include="TestData\LatestCoreMBA\HarvestedTrimmedSCD.wxs" CopyToOutputDirectory="PreserveNewest"/>
31 <Content Include="TestData\LatestCoreMBA\SelfContainedBundle.wxs" CopyToOutputDirectory="PreserveNewest"/>
@@ -67,6 +69,7 @@
69 </ItemGroup>
70
71 <Target Name="PublishExamples" AfterTargets="Build">
72 + <Exec Command='dotnet publish -o "%(CoreMBAProject.PublishPath)\fdd" -r win-x86 -c $(Configuration) --self-contained false "%(CoreMBAProject.Identity)"' />
73 <Exec Command='dotnet publish -o "%(CoreMBAProject.PublishPath)\scd" -r win-x86 -c $(Configuration) --self-contained true "%(CoreMBAProject.Identity)"' />
74 <Exec Command='dotnet publish -o "%(CoreMBAProject.PublishPath)\trimmedscd" -r win-x86 -c $(Configuration) --self-contained true -p:PublishTrimmed=true "%(CoreMBAProject.Identity)"' />
75 </Target>
src/wixext/BalBurnBackendExtension.cs
+21 -5
@@ -28,15 +28,17 @@ namespace WixToolset.Bal
28
29 var isStdBA = baId.StartsWith("WixStandardBootstrapperApplication");
30 var isMBA = baId.StartsWith("ManagedBootstrapperApplicationHost");
31 + var isDNC = baId.StartsWith("DotNetCoreBootstrapperApplicationHost");
32 + var isSCD = isDNC && this.VerifySCD(section);
33
32 - if (isStdBA || isMBA)
34 + if (isStdBA || isMBA || isDNC)
35 {
36 this.VerifyBAFunctions(section);
37 }
38
37 - if (isMBA)
39 + if (isMBA || (isDNC && !isSCD))
40 {
39 - this.VerifyPrereqPackages(section);
41 + this.VerifyPrereqPackages(section, isDNC);
42 }
43 }
44
@@ -78,12 +80,13 @@ namespace WixToolset.Bal
80 }
81 }
82
81 - private void VerifyPrereqPackages(IntermediateSection section)
83 + private void VerifyPrereqPackages(IntermediateSection section, bool isDNC)
84 {
85 var prereqInfoTuples = section.Tuples.OfType<WixMbaPrereqInformationTuple>().ToList();
86 if (prereqInfoTuples.Count == 0)
87 {
86 - this.Messaging.Write(BalErrors.MissingPrereq());
88 + var message = isDNC ? BalErrors.MissingDNCPrereq() : BalErrors.MissingMBAPrereq();
89 + this.Messaging.Write(message);
90 return;
91 }
92
@@ -115,5 +118,18 @@ namespace WixToolset.Bal
118 }
119 }
120 }
121 +
122 + private bool VerifySCD(IntermediateSection section)
123 + {
124 + var isSCD = false;
125 +
126 + var dncOptions = section.Tuples.OfType<WixDncOptionsTuple>().SingleOrDefault();
127 + if (dncOptions != null)
128 + {
129 + isSCD = dncOptions.SelfContainedDeployment != 0;
130 + }
131 +
132 + return isSCD;
133 + }
134 }
135 }
src/wixext/BalCompiler.cs
+85 -1
@@ -63,6 +63,9 @@ namespace WixToolset.Bal
63 case "WixManagedBootstrapperApplicationHost":
64 this.ParseWixManagedBootstrapperApplicationHostElement(intermediate, section, element);
65 break;
66 + case "WixDotNetCoreBootstrapperApplication":
67 + this.ParseWixDotNetCoreBootstrapperApplicationElement(intermediate, section, element);
68 + break;
69 default:
70 this.ParseHelper.UnexpectedElement(parentElement, element);
71 break;
@@ -200,7 +203,9 @@ namespace WixToolset.Bal
203 case "BAFactoryAssembly":
204 if (YesNoType.Yes == this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attribute))
205 {
203 - section.AddTuple(new WixBalBAFactoryAssemblyTuple(sourceLineNumbers)
206 + // There can only be one.
207 + var id = new Identifier(AccessModifier.Public, "TheBAFactoryAssembly");
208 + section.AddTuple(new WixBalBAFactoryAssemblyTuple(sourceLineNumbers, id)
209 {
210 PayloadId = payloadId,
211 });
@@ -655,5 +660,84 @@ namespace WixToolset.Bal
660 }
661 }
662 }
663 +
664 + /// <summary>
665 + /// Parses a WixDotNetCoreBootstrapperApplication element for Bundles.
666 + /// </summary>
667 + /// <param name="node">The element to parse.</param>
668 + private void ParseWixDotNetCoreBootstrapperApplicationElement(Intermediate intermediate, IntermediateSection section, XElement node)
669 + {
670 + var sourceLineNumbers = this.ParseHelper.GetSourceLineNumbers(node);
671 + string logoFile = null;
672 + string themeFile = null;
673 + string localizationFile = null;
674 + var selfContainedDeployment = YesNoType.NotSet;
675 +
676 + foreach (var attrib in node.Attributes())
677 + {
678 + if (String.IsNullOrEmpty(attrib.Name.NamespaceName) || this.Namespace == attrib.Name.Namespace)
679 + {
680 + switch (attrib.Name.LocalName)
681 + {
682 + case "LogoFile":
683 + logoFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
684 + break;
685 + case "ThemeFile":
686 + themeFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
687 + break;
688 + case "LocalizationFile":
689 + localizationFile = this.ParseHelper.GetAttributeValue(sourceLineNumbers, attrib);
690 + break;
691 + case "SelfContainedDeployment":
692 + selfContainedDeployment = this.ParseHelper.GetAttributeYesNoValue(sourceLineNumbers, attrib);
693 + break;
694 + default:
695 + this.ParseHelper.UnexpectedAttribute(node, attrib);
696 + break;
697 + }
698 + }
699 + else
700 + {
701 + this.ParseHelper.ParseExtensionAttribute(this.Context.Extensions, intermediate, section, node, attrib);
702 + }
703 + }
704 +
705 + this.ParseHelper.ParseForExtensionElements(this.Context.Extensions, intermediate, section, node);
706 +
707 + if (!this.Messaging.EncounteredError)
708 + {
709 + if (!String.IsNullOrEmpty(logoFile))
710 + {
711 + section.AddTuple(new WixVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, "DncPreqbaLogo"))
712 + {
713 + Value = logoFile,
714 + });
715 + }
716 +
717 + if (!String.IsNullOrEmpty(themeFile))
718 + {
719 + section.AddTuple(new WixVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, "DncPreqbaThemeXml"))
720 + {
721 + Value = themeFile,
722 + });
723 + }
724 +
725 + if (!String.IsNullOrEmpty(localizationFile))
726 + {
727 + section.AddTuple(new WixVariableTuple(sourceLineNumbers, new Identifier(AccessModifier.Public, "DncPreqbaThemeWxl"))
728 + {
729 + Value = localizationFile,
730 + });
731 + }
732 +
733 + if (YesNoType.Yes == selfContainedDeployment)
734 + {
735 + section.AddTuple(new WixDncOptionsTuple(sourceLineNumbers)
736 + {
737 + SelfContainedDeployment = 1,
738 + });
739 + }
740 + }
741 + }
742 }
743 }
src/wixext/BalErrors.cs
+9 -3
@@ -18,9 +18,14 @@ namespace WixToolset.Bal
18 return Message(sourceLineNumbers, Ids.BAFunctionsPayloadRequiredInUXContainer, "The BAFunctions DLL Payload element must be located inside the BootstrapperApplication container.");
19 }
20
21 - public static Message MissingPrereq()
21 + public static Message MissingDNCPrereq()
22 {
23 - return Message(null, Ids.MissingPrereq, "There must be at least one PrereqPackage when using the ManagedBootstrapperApplicationHost.\nThis is typically done by using the WixNetFxExtension and referencing one of the NetFxAsPrereq package groups.");
23 + return Message(null, Ids.MissingDNCPrereq, "There must be at least one PrereqPackage when using the DotNetCoreBootstrapperApplicationHost with SelfContainedDeployment set to \"no\".");
24 + }
25 +
26 + public static Message MissingMBAPrereq()
27 + {
28 + return Message(null, Ids.MissingMBAPrereq, "There must be at least one PrereqPackage when using the ManagedBootstrapperApplicationHost.\nThis is typically done by using the WixNetFxExtension and referencing one of the NetFxAsPrereq package groups.");
29 }
30
31 public static Message MultipleBAFunctions(SourceLineNumber sourceLineNumbers)
@@ -46,10 +51,11 @@ namespace WixToolset.Bal
51 public enum Ids
52 {
53 AttributeRequiresPrereqPackage = 6801,
49 - MissingPrereq = 6802,
54 + MissingMBAPrereq = 6802,
55 MultiplePrereqLicenses = 6803,
56 MultipleBAFunctions = 6804,
57 BAFunctionsPayloadRequiredInUXContainer = 6805,
58 + MissingDNCPrereq = 6806,
59 }
60 }
61 }
src/wixext/Tuples/BalTupleDefinitions.cs
+5
@@ -11,6 +11,7 @@ namespace WixToolset.Bal
11 WixBalBAFactoryAssembly,
12 WixBalBAFunctions,
13 WixBalCondition,
14 + WixDncOptions,
15 WixMbaPrereqInformation,
16 WixStdbaOptions,
17 WixStdbaOverridableVariable,
@@ -43,6 +44,9 @@ namespace WixToolset.Bal
44 case BalTupleDefinitionType.WixBalCondition:
45 return BalTupleDefinitions.WixBalCondition;
46
47 + case BalTupleDefinitionType.WixDncOptions:
48 + return BalTupleDefinitions.WixDncOptions;
49 +
50 case BalTupleDefinitionType.WixMbaPrereqInformation:
51 return BalTupleDefinitions.WixMbaPrereqInformation;
52
@@ -62,6 +66,7 @@ namespace WixToolset.Bal
66 WixBalBAFactoryAssembly.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag);
67 WixBalBAFunctions.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag);
68 WixBalCondition.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag);
69 + WixDncOptions.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag);
70 WixMbaPrereqInformation.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag);
71 WixStdbaOptions.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag);
72 WixStdbaOverridableVariable.AddTag(BurnConstants.BootstrapperApplicationDataTupleDefinitionTag);
src/wixext/Tuples/WixDncOptionsTuple.cs new
+47
@@ -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 +
3 +namespace 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 WixDncOptions = new IntermediateTupleDefinition(
11 + BalTupleDefinitionType.WixDncOptions.ToString(),
12 + new[]
13 + {
14 + new IntermediateFieldDefinition(nameof(WixDncOptionsTupleFields.SelfContainedDeployment), IntermediateFieldType.Number),
15 + },
16 + typeof(WixDncOptionsTuple));
17 + }
18 +}
19 +
20 +namespace WixToolset.Bal.Tuples
21 +{
22 + using WixToolset.Data;
23 +
24 + public enum WixDncOptionsTupleFields
25 + {
26 + SelfContainedDeployment,
27 + }
28 +
29 + public class WixDncOptionsTuple : IntermediateTuple
30 + {
31 + public WixDncOptionsTuple() : base(BalTupleDefinitions.WixDncOptions, null, null)
32 + {
33 + }
34 +
35 + public WixDncOptionsTuple(SourceLineNumber sourceLineNumber, Identifier id = null) : base(BalTupleDefinitions.WixDncOptions, sourceLineNumber, id)
36 + {
37 + }
38 +
39 + public IntermediateField this[WixDncOptionsTupleFields index] => this.Fields[(int)index];
40 +
41 + public int SelfContainedDeployment
42 + {
43 + get => this.Fields[(int)WixDncOptionsTupleFields.SelfContainedDeployment].AsNumber();
44 + set => this.Set((int)WixDncOptionsTupleFields.SelfContainedDeployment, value);
45 + }
46 + }
47 +}
\ No newline at end of file
src/wixext/bal.xsd
+36
@@ -215,6 +215,42 @@
215 </xs:complexType>
216 </xs:element>
217
218 + <xs:element name="WixDotNetCoreBootstrapperApplication">
219 + <xs:annotation>
220 + <xs:documentation>
221 + Configures the DotNetCoreBootstrapperApplicationHost for a Bundle.
222 + </xs:documentation>
223 + <xs:appinfo>
224 + <xse:parent namespace="http://wixtoolset.org/schemas/v4/wxs" ref="BootstrapperApplicationRef" />
225 + </xs:appinfo>
226 + </xs:annotation>
227 + <xs:complexType>
228 + <xs:attribute name="LogoFile" type="xs:string">
229 + <xs:annotation>
230 + <xs:documentation>Source file of the logo graphic.</xs:documentation>
231 + </xs:annotation>
232 + </xs:attribute>
233 + <xs:attribute name="ThemeFile" type="xs:string">
234 + <xs:annotation>
235 + <xs:documentation>Source file of the theme XML.</xs:documentation>
236 + </xs:annotation>
237 + </xs:attribute>
238 + <xs:attribute name="LocalizationFile" type="xs:string">
239 + <xs:annotation>
240 + <xs:documentation>Source file of the theme localization .wxl file.</xs:documentation>
241 + </xs:annotation>
242 + </xs:attribute>
243 + <xs:attribute name="SelfContainedDeployment" type="YesNoType">
244 + <xs:annotation>
245 + <xs:documentation>
246 + Whether the .NET Core BA was published as self-contained (SCD).
247 + If using PublishTrimmed in the .NET Core project, there must be an item group with &lt;TrimmerRootAssembly Include="System.Runtime.Loader" /&gt;
248 + </xs:documentation>
249 + </xs:annotation>
250 + </xs:attribute>
251 + </xs:complexType>
252 + </xs:element>
253 +
254 <xs:attribute name="BAFactoryAssembly" type="YesNoType">
255 <xs:annotation>
256 <xs:documentation>
src/wixlib/Dnc.wxs
+25
@@ -13,6 +13,31 @@
13 </BootstrapperApplication>
14 </Fragment>
15
16 + <Fragment>
17 + <BootstrapperApplication Id='DotNetCoreBootstrapperApplicationHost.RtfLicense' SourceFile='dnchost.dll'>
18 + <PayloadGroupRef Id='Dnc' />
19 + <PayloadGroupRef Id='DncPreqStandard' />
20 + </BootstrapperApplication>
21 + </Fragment>
22 +
23 + <Fragment>
24 + <BootstrapperApplication Id='DotNetCoreBootstrapperApplicationHost.Minimal' SourceFile='dnchost.dll'>
25 + <PayloadGroupRef Id='Dnc' />
26 + </BootstrapperApplication>
27 + </Fragment>
28 +
29 + <Fragment>
30 + <BootstrapperApplication Id='DotNetCoreBootstrapperApplicationHost.RtfLicense.Minimal' SourceFile='dnchost.dll'>
31 + <PayloadGroupRef Id='Dnc' />
32 + </BootstrapperApplication>
33 + </Fragment>
34 +
35 + <Fragment>
36 + <BootstrapperApplication Id='DotNetCoreBootstrapperApplicationHost.Foundation' SourceFile='dnchost.dll'>
37 + <PayloadGroupRef Id='Dnc' />
38 + </BootstrapperApplication>
39 + </Fragment>
40 +
41 <Fragment>
42 <PayloadGroup Id='Dnc'>
43 <Payload Compressed='yes' SourceFile='nethost.dll' />