diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-04-19 17:15:05 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-04-19 18:35:15 -0500 |
commit | 57fd164d56466a52854e825afd5fdc2b6b97f12a (patch) | |
tree | 7d4ace6d7a55c2a50302e3b6866456026a2c6222 | |
parent | 6435d26c7e2ce54ec38d0cc9eb4d2cb10e9614e0 (diff) | |
download | wix-57fd164d56466a52854e825afd5fdc2b6b97f12a.tar.gz wix-57fd164d56466a52854e825afd5fdc2b6b97f12a.tar.bz2 wix-57fd164d56466a52854e825afd5fdc2b6b97f12a.zip |
Replace Dnc.Host with Dnc.HostGenerator to support linker trimming.
48 files changed, 626 insertions, 565 deletions
diff --git a/src/clean.cmd b/src/clean.cmd index 5bedadbd..bd44bed4 100644 --- a/src/clean.cmd +++ b/src/clean.cmd | |||
@@ -27,6 +27,7 @@ if exist "%_NUGET_CACHE%\wixtoolset.core.testpackage" rd /s/q "%_NUGET_CACHE%\wi | |||
27 | if exist "%_NUGET_CACHE%\wixtoolset.core.windowsinstaller" rd /s/q "%_NUGET_CACHE%\wixtoolset.core.windowsinstaller" | 27 | if exist "%_NUGET_CACHE%\wixtoolset.core.windowsinstaller" rd /s/q "%_NUGET_CACHE%\wixtoolset.core.windowsinstaller" |
28 | if exist "%_NUGET_CACHE%\wixtoolset.data" rd /s/q "%_NUGET_CACHE%\wixtoolset.data" | 28 | if exist "%_NUGET_CACHE%\wixtoolset.data" rd /s/q "%_NUGET_CACHE%\wixtoolset.data" |
29 | if exist "%_NUGET_CACHE%\wixtoolset.dependency.wixext" rd /s/q "%_NUGET_CACHE%\wixtoolset.dependency.wixext" | 29 | if exist "%_NUGET_CACHE%\wixtoolset.dependency.wixext" rd /s/q "%_NUGET_CACHE%\wixtoolset.dependency.wixext" |
30 | if exist "%_NUGET_CACHE%\wixtoolset.dnc.hostgenerator" rd /s/q "%_NUGET_CACHE%\wixtoolset.dnc.hostgenerator" | ||
30 | if exist "%_NUGET_CACHE%\wixtoolset.dtf.compression" rd /s/q "%_NUGET_CACHE%\wixtoolset.dtf.compression" | 31 | if exist "%_NUGET_CACHE%\wixtoolset.dtf.compression" rd /s/q "%_NUGET_CACHE%\wixtoolset.dtf.compression" |
31 | if exist "%_NUGET_CACHE%\wixtoolset.dtf.compression.cab" rd /s/q "%_NUGET_CACHE%\wixtoolset.dtf.compression.cab" | 32 | if exist "%_NUGET_CACHE%\wixtoolset.dtf.compression.cab" rd /s/q "%_NUGET_CACHE%\wixtoolset.dtf.compression.cab" |
32 | if exist "%_NUGET_CACHE%\wixtoolset.dtf.customaction" rd /s/q "%_NUGET_CACHE%\wixtoolset.dtf.customaction" | 33 | if exist "%_NUGET_CACHE%\wixtoolset.dtf.customaction" rd /s/q "%_NUGET_CACHE%\wixtoolset.dtf.customaction" |
diff --git a/src/ext/Bal/Bal.wixext.sln b/src/ext/Bal/Bal.wixext.sln index ee14dd97..dbb70a82 100644 --- a/src/ext/Bal/Bal.wixext.sln +++ b/src/ext/Bal/Bal.wixext.sln | |||
@@ -15,7 +15,7 @@ Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "bal", "wixlib\bal.wixproj", | |||
15 | EndProject | 15 | EndProject |
16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Bal.wixext", "wixext\WixToolset.Bal.wixext.csproj", "{BF720A63-9D7B-456E-B60C-8122852D9FED}" | 16 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Bal.wixext", "wixext\WixToolset.Bal.wixext.csproj", "{BF720A63-9D7B-456E-B60C-8122852D9FED}" |
17 | EndProject | 17 | EndProject |
18 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Dnc.Host", "WixToolset.Dnc.Host\WixToolset.Dnc.Host.csproj", "{0D780900-C2FF-4FA2-8CB5-8A19768724C5}" | 18 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Dnc.HostGenerator", "WixToolset.Dnc.HostGenerator\WixToolset.Dnc.HostGenerator.csproj", "{D6A58B36-D47E-4020-A130-58B0CEAF01A2}" |
19 | EndProject | 19 | EndProject |
20 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Mba.Host", "WixToolset.Mba.Host\WixToolset.Mba.Host.csproj", "{F2BA1935-70FA-4156-B161-FD03850B4FAA}" | 20 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolset.Mba.Host", "WixToolset.Mba.Host\WixToolset.Mba.Host.csproj", "{F2BA1935-70FA-4156-B161-FD03850B4FAA}" |
21 | EndProject | 21 | EndProject |
@@ -23,6 +23,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.FullFramework2MBA", | |||
23 | EndProject | 23 | EndProject |
24 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Example.TestEngine", "test\examples\TestEngine\Example.TestEngine.vcxproj", "{3D44B67D-A475-49BA-8310-E39F6C117CC9}" | 24 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Example.TestEngine", "test\examples\TestEngine\Example.TestEngine.vcxproj", "{3D44B67D-A475-49BA-8310-E39F6C117CC9}" |
25 | EndProject | 25 | EndProject |
26 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.Dnc.HostGenerator", "test\WixToolsetTest.Dnc.HostGenerator\WixToolsetTest.Dnc.HostGenerator.csproj", "{38D80FC7-EBD4-4902-A114-C93AA75CFCA0}" | ||
27 | EndProject | ||
26 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.ManagedHost", "test\WixToolsetTest.ManagedHost\WixToolsetTest.ManagedHost.csproj", "{FED9D707-E5C3-4867-87B0-FABDB5EB0823}" | 28 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "WixToolsetTest.ManagedHost", "test\WixToolsetTest.ManagedHost\WixToolsetTest.ManagedHost.csproj", "{FED9D707-E5C3-4867-87B0-FABDB5EB0823}" |
27 | EndProject | 29 | EndProject |
28 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.FullFramework4MBA", "test\examples\FullFramework4MBA\Example.FullFramework4MBA.csproj", "{44297646-706D-4508-8E96-1B35B109694C}" | 30 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Example.FullFramework4MBA", "test\examples\FullFramework4MBA\Example.FullFramework4MBA.csproj", "{44297646-706D-4508-8E96-1B35B109694C}" |
@@ -125,22 +127,22 @@ Global | |||
125 | {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x64.Build.0 = Release|Any CPU | 127 | {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x64.Build.0 = Release|Any CPU |
126 | {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x86.ActiveCfg = Release|Any CPU | 128 | {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x86.ActiveCfg = Release|Any CPU |
127 | {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x86.Build.0 = Release|Any CPU | 129 | {BF720A63-9D7B-456E-B60C-8122852D9FED}.Release|x86.Build.0 = Release|Any CPU |
128 | {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | 130 | {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
129 | {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|Any CPU.Build.0 = Debug|Any CPU | 131 | {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Debug|Any CPU.Build.0 = Debug|Any CPU |
130 | {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|ARM64.ActiveCfg = Debug|Any CPU | 132 | {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Debug|ARM64.ActiveCfg = Debug|AnyCPU |
131 | {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|ARM64.Build.0 = Debug|Any CPU | 133 | {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Debug|ARM64.Build.0 = Debug|AnyCPU |
132 | {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|x64.ActiveCfg = Debug|Any CPU | 134 | {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Debug|x64.ActiveCfg = Debug|AnyCPU |
133 | {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|x64.Build.0 = Debug|Any CPU | 135 | {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Debug|x64.Build.0 = Debug|AnyCPU |
134 | {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|x86.ActiveCfg = Debug|Any CPU | 136 | {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Debug|x86.ActiveCfg = Debug|AnyCPU |
135 | {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Debug|x86.Build.0 = Debug|Any CPU | 137 | {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Debug|x86.Build.0 = Debug|AnyCPU |
136 | {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|Any CPU.ActiveCfg = Release|Any CPU | 138 | {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Release|Any CPU.ActiveCfg = Release|Any CPU |
137 | {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|Any CPU.Build.0 = Release|Any CPU | 139 | {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Release|Any CPU.Build.0 = Release|Any CPU |
138 | {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|ARM64.ActiveCfg = Release|Any CPU | 140 | {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Release|ARM64.ActiveCfg = Release|AnyCPU |
139 | {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|ARM64.Build.0 = Release|Any CPU | 141 | {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Release|ARM64.Build.0 = Release|AnyCPU |
140 | {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|x64.ActiveCfg = Release|Any CPU | 142 | {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Release|x64.ActiveCfg = Release|AnyCPU |
141 | {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|x64.Build.0 = Release|Any CPU | 143 | {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Release|x64.Build.0 = Release|AnyCPU |
142 | {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|x86.ActiveCfg = Release|Any CPU | 144 | {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Release|x86.ActiveCfg = Release|AnyCPU |
143 | {0D780900-C2FF-4FA2-8CB5-8A19768724C5}.Release|x86.Build.0 = Release|Any CPU | 145 | {D6A58B36-D47E-4020-A130-58B0CEAF01A2}.Release|x86.Build.0 = Release|AnyCPU |
144 | {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | 146 | {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
145 | {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|Any CPU.Build.0 = Debug|Any CPU | 147 | {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|Any CPU.Build.0 = Debug|Any CPU |
146 | {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|ARM64.ActiveCfg = Debug|Any CPU | 148 | {F2BA1935-70FA-4156-B161-FD03850B4FAA}.Debug|ARM64.ActiveCfg = Debug|Any CPU |
@@ -189,6 +191,22 @@ Global | |||
189 | {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|x64.Build.0 = Release|x64 | 191 | {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|x64.Build.0 = Release|x64 |
190 | {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|x86.ActiveCfg = Release|Win32 | 192 | {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|x86.ActiveCfg = Release|Win32 |
191 | {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|x86.Build.0 = Release|Win32 | 193 | {3D44B67D-A475-49BA-8310-E39F6C117CC9}.Release|x86.Build.0 = Release|Win32 |
194 | {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
195 | {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
196 | {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Debug|ARM64.ActiveCfg = Debug|Any CPU | ||
197 | {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Debug|ARM64.Build.0 = Debug|Any CPU | ||
198 | {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Debug|x64.ActiveCfg = Debug|Any CPU | ||
199 | {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Debug|x64.Build.0 = Debug|Any CPU | ||
200 | {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Debug|x86.ActiveCfg = Debug|Any CPU | ||
201 | {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Debug|x86.Build.0 = Debug|Any CPU | ||
202 | {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
203 | {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Release|Any CPU.Build.0 = Release|Any CPU | ||
204 | {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Release|ARM64.ActiveCfg = Release|Any CPU | ||
205 | {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Release|ARM64.Build.0 = Release|Any CPU | ||
206 | {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Release|x64.ActiveCfg = Release|Any CPU | ||
207 | {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Release|x64.Build.0 = Release|Any CPU | ||
208 | {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Release|x86.ActiveCfg = Release|Any CPU | ||
209 | {38D80FC7-EBD4-4902-A114-C93AA75CFCA0}.Release|x86.Build.0 = Release|Any CPU | ||
192 | {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | 210 | {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|Any CPU.ActiveCfg = Debug|Any CPU |
193 | {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|Any CPU.Build.0 = Debug|Any CPU | 211 | {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|Any CPU.Build.0 = Debug|Any CPU |
194 | {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|ARM64.ActiveCfg = Debug|Any CPU | 212 | {FED9D707-E5C3-4867-87B0-FABDB5EB0823}.Debug|ARM64.ActiveCfg = Debug|Any CPU |
diff --git a/src/ext/Bal/WixToolset.Dnc.Host/BootstrapperApplicationFactory.cs b/src/ext/Bal/WixToolset.Dnc.Host/BootstrapperApplicationFactory.cs deleted file mode 100644 index d38fd1a9..00000000 --- a/src/ext/Bal/WixToolset.Dnc.Host/BootstrapperApplicationFactory.cs +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.Dnc.Host | ||
4 | { | ||
5 | using System; | ||
6 | using System.Linq; | ||
7 | using System.Reflection; | ||
8 | using System.Runtime.InteropServices; | ||
9 | |||
10 | delegate IBootstrapperApplicationFactory StaticEntryDelegate([MarshalAs(UnmanagedType.LPWStr)] string baFactoryAssemblyName, [MarshalAs(UnmanagedType.LPWStr)] string baFactoryAssemblyPath); | ||
11 | |||
12 | /// <summary> | ||
13 | /// Entry point for the .NET Core host to create and return the BA to the engine. | ||
14 | /// Reflection is used instead of referencing WixToolset.Mba.Core directly to avoid requiring it in the AssemblyLoadContext. | ||
15 | /// </summary> | ||
16 | public sealed class BootstrapperApplicationFactory : IBootstrapperApplicationFactory | ||
17 | { | ||
18 | private string baFactoryAssemblyName; | ||
19 | private string baFactoryAssemblyPath; | ||
20 | |||
21 | public BootstrapperApplicationFactory(string baFactoryAssemblyName, string baFactoryAssemblyPath) | ||
22 | { | ||
23 | this.baFactoryAssemblyName = baFactoryAssemblyName; | ||
24 | this.baFactoryAssemblyPath = baFactoryAssemblyPath; | ||
25 | } | ||
26 | |||
27 | /// <summary> | ||
28 | /// Loads the bootstrapper application assembly and calls its IBootstrapperApplicationFactory.Create method. | ||
29 | /// </summary> | ||
30 | /// <param name="pArgs">Pointer to BOOTSTRAPPER_CREATE_ARGS struct.</param> | ||
31 | /// <param name="pResults">Pointer to BOOTSTRAPPER_CREATE_RESULTS struct.</param> | ||
32 | /// <exception cref="MissingAttributeException">The bootstrapper application assembly | ||
33 | /// does not define the <see cref="BootstrapperApplicationFactoryAttribute"/>.</exception> | ||
34 | public void Create(IntPtr pArgs, IntPtr pResults) | ||
35 | { | ||
36 | // Load the BA's IBootstrapperApplicationFactory. | ||
37 | var baFactoryType = BootstrapperApplicationFactory.GetBAFactoryTypeFromAssembly(this.baFactoryAssemblyName, this.baFactoryAssemblyPath); | ||
38 | var baFactory = Activator.CreateInstance(baFactoryType); | ||
39 | if (null == baFactory) | ||
40 | { | ||
41 | throw new InvalidBootstrapperApplicationFactoryException(); | ||
42 | } | ||
43 | |||
44 | var createMethod = baFactoryType.GetMethod(nameof(Create), new[] { typeof(IntPtr), typeof(IntPtr) }); | ||
45 | if (null == createMethod) | ||
46 | { | ||
47 | throw new InvalidBootstrapperApplicationFactoryException(); | ||
48 | } | ||
49 | createMethod.Invoke(baFactory, new object[] { pArgs, pResults }); | ||
50 | } | ||
51 | |||
52 | /// <summary> | ||
53 | /// Locates the <see cref="BootstrapperApplicationFactoryAttribute"/> and returns the specified type. | ||
54 | /// </summary> | ||
55 | /// <param name="assemblyName">The assembly that defines the IBootstrapperApplicationFactory implementation.</param> | ||
56 | /// <returns>The bootstrapper application factory <see cref="Type"/>.</returns> | ||
57 | private static Type GetBAFactoryTypeFromAssembly(string assemblyName, string assemblyPath) | ||
58 | { | ||
59 | // The default ALC shouldn't need help loading the assembly, since the host should have provided the deps.json | ||
60 | // when starting the runtime. But it doesn't hurt so keep this in case an isolated ALC is ever needed. | ||
61 | var alc = new DnchostAssemblyLoadContext(assemblyPath, false); | ||
62 | var asm = alc.LoadFromAssemblyName(new AssemblyName(assemblyName)); | ||
63 | |||
64 | var attr = asm.GetCustomAttributes() | ||
65 | .Where(a => a.GetType().FullName == "WixToolset.Mba.Core.BootstrapperApplicationFactoryAttribute") | ||
66 | .SingleOrDefault(); | ||
67 | |||
68 | if (null == attr) | ||
69 | { | ||
70 | throw new MissingAttributeException(); | ||
71 | } | ||
72 | |||
73 | var baFactoryTypeProperty = attr.GetType().GetProperty("BootstrapperApplicationFactoryType", typeof(Type)); | ||
74 | if (baFactoryTypeProperty == null || baFactoryTypeProperty.GetMethod == null) | ||
75 | { | ||
76 | throw new MissingAttributeException(); | ||
77 | } | ||
78 | |||
79 | var baFactoryType = (Type)baFactoryTypeProperty.GetMethod.Invoke(attr, null); | ||
80 | return baFactoryType; | ||
81 | } | ||
82 | |||
83 | // Entry point for the DNC host. | ||
84 | public static IBootstrapperApplicationFactory CreateBAFactory([MarshalAs(UnmanagedType.LPWStr)] string baFactoryAssemblyName, [MarshalAs(UnmanagedType.LPWStr)] string baFactoryAssemblyPath) | ||
85 | { | ||
86 | return new BootstrapperApplicationFactory(baFactoryAssemblyName, baFactoryAssemblyPath); | ||
87 | } | ||
88 | } | ||
89 | } | ||
diff --git a/src/ext/Bal/WixToolset.Dnc.Host/DnchostAssemblyLoadContext.cs b/src/ext/Bal/WixToolset.Dnc.Host/DnchostAssemblyLoadContext.cs deleted file mode 100644 index 1a383058..00000000 --- a/src/ext/Bal/WixToolset.Dnc.Host/DnchostAssemblyLoadContext.cs +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace 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/ext/Bal/WixToolset.Dnc.Host/Exceptions.cs b/src/ext/Bal/WixToolset.Dnc.Host/Exceptions.cs deleted file mode 100644 index 32d4d4c5..00000000 --- a/src/ext/Bal/WixToolset.Dnc.Host/Exceptions.cs +++ /dev/null | |||
@@ -1,145 +0,0 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace 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/ext/Bal/WixToolset.Dnc.Host/IBootstrapperApplicationFactory.cs b/src/ext/Bal/WixToolset.Dnc.Host/IBootstrapperApplicationFactory.cs deleted file mode 100644 index 96731192..00000000 --- a/src/ext/Bal/WixToolset.Dnc.Host/IBootstrapperApplicationFactory.cs +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace 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/ext/Bal/WixToolset.Dnc.Host/NativeMethods.cs b/src/ext/Bal/WixToolset.Dnc.Host/NativeMethods.cs deleted file mode 100644 index 6dc393c6..00000000 --- a/src/ext/Bal/WixToolset.Dnc.Host/NativeMethods.cs +++ /dev/null | |||
@@ -1,18 +0,0 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace 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/ext/Bal/WixToolset.Dnc.Host/WixToolset.Dnc.Host.csproj b/src/ext/Bal/WixToolset.Dnc.Host/WixToolset.Dnc.Host.csproj deleted file mode 100644 index a2f0d8ec..00000000 --- a/src/ext/Bal/WixToolset.Dnc.Host/WixToolset.Dnc.Host.csproj +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
3 | |||
4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
5 | <PropertyGroup> | ||
6 | <TargetFramework>netcoreapp3.1</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 | <DebugType>embedded</DebugType> | ||
11 | <PlatformTarget>AnyCPU</PlatformTarget> | ||
12 | </PropertyGroup> | ||
13 | |||
14 | <ItemGroup> | ||
15 | <HeaderPath Include="$(BaseOutputPath)obj\$(AssemblyName).h"> | ||
16 | <Visible>False</Visible> | ||
17 | </HeaderPath> | ||
18 | </ItemGroup> | ||
19 | |||
20 | <Target Name="GenerateIdentityHeader" AfterTargets="Build" Inputs="$(TargetPath)" Outputs="@(HeaderPath)"> | ||
21 | <GetAssemblyIdentity AssemblyFiles="$(TargetPath)"> | ||
22 | <Output TaskParameter="Assemblies" ItemName="AssemblyIdentity" /> | ||
23 | </GetAssemblyIdentity> | ||
24 | <ItemGroup> | ||
25 | <Line Include='#define DNC_ASSEMBLY_FILE_NAME L"$(AssemblyName).dll"' /> | ||
26 | <Line Include='#define DNC_ASSEMBLY_FULL_NAME "%(AssemblyIdentity.Identity)"' /> | ||
27 | <Line Include='#define DNC_ENTRY_TYPE "$(RootNamespace).BootstrapperApplicationFactory"' /> | ||
28 | <Line Include='#define DNC_ENTRY_TYPEW L"$(RootNamespace).BootstrapperApplicationFactory,$(AssemblyName)"' /> | ||
29 | <Line Include='#define DNC_STATIC_ENTRY_METHOD "CreateBAFactory"' /> | ||
30 | <Line Include='#define DNC_STATIC_ENTRY_METHODW L"CreateBAFactory"' /> | ||
31 | <Line Include='#define DNC_STATIC_ENTRY_DELEGATEW L"$(RootNamespace).StaticEntryDelegate,$(AssemblyName)"' /> | ||
32 | </ItemGroup> | ||
33 | <Message Importance="normal" Text="Generating identity definitions into @(HeaderPath->'%(FullPath)')" /> | ||
34 | <WriteLinesToFile File="@(HeaderPath)" Lines="@(Line)" Overwrite="True" /> | ||
35 | <ItemGroup> | ||
36 | <FileWrites Include="@(HeaderPath)" /> | ||
37 | </ItemGroup> | ||
38 | </Target> | ||
39 | </Project> | ||
diff --git a/src/ext/Bal/WixToolset.Dnc.HostGenerator/DncHostGenerator.cs b/src/ext/Bal/WixToolset.Dnc.HostGenerator/DncHostGenerator.cs new file mode 100644 index 00000000..088b2b49 --- /dev/null +++ b/src/ext/Bal/WixToolset.Dnc.HostGenerator/DncHostGenerator.cs | |||
@@ -0,0 +1,127 @@ | |||
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.Dnc.HostGenerator | ||
4 | { | ||
5 | using System; | ||
6 | using System.Diagnostics.CodeAnalysis; | ||
7 | using System.Text; | ||
8 | using Microsoft.CodeAnalysis; | ||
9 | using Microsoft.CodeAnalysis.Text; | ||
10 | |||
11 | [Generator] | ||
12 | public sealed class DncHostGenerator : ISourceGenerator | ||
13 | { | ||
14 | public static readonly string Version = String.Format($"{ThisAssembly.Git.SemVer.Major}.{ThisAssembly.Git.SemVer.Minor}.{ThisAssembly.Git.SemVer.Patch}{ThisAssembly.Git.SemVer.DashLabel}+{ThisAssembly.Git.Sha}"); | ||
15 | public static readonly string TargetAttributeFullName = "WixToolset.Mba.Core.BootstrapperApplicationFactoryAttribute"; | ||
16 | |||
17 | [SuppressMessage("MicrosoftCodeAnalysisReleaseTracking", "RS2008:Enable analyzer release tracking", Justification = "Tracking not needed")] | ||
18 | public static readonly DiagnosticDescriptor MissingFactoryAttributeDescriptor = new DiagnosticDescriptor( | ||
19 | "WIXBAL001", | ||
20 | $"Missing assembly level attribute {TargetAttributeFullName}.", | ||
21 | $"Add [assembly: {TargetAttributeFullName}(typeof(<your IBootstrapperApplicationFactory>)].", | ||
22 | "WixToolset.Bal.wixext", | ||
23 | DiagnosticSeverity.Error, | ||
24 | true | ||
25 | ); | ||
26 | |||
27 | public void Initialize(GeneratorInitializationContext context) | ||
28 | { | ||
29 | } | ||
30 | |||
31 | public void Execute(GeneratorExecutionContext context) | ||
32 | { | ||
33 | var symbolDisplayFormat = new SymbolDisplayFormat(typeQualificationStyle: SymbolDisplayTypeQualificationStyle.NameAndContainingTypesAndNamespaces); | ||
34 | |||
35 | string baFactoryClassName = null; | ||
36 | foreach (var assemblyAttribute in context.Compilation.Assembly.GetAttributes()) | ||
37 | { | ||
38 | var fullAssemblyTypeName = assemblyAttribute.AttributeClass.ToDisplayString(symbolDisplayFormat); | ||
39 | |||
40 | if (fullAssemblyTypeName == TargetAttributeFullName && | ||
41 | assemblyAttribute.ConstructorArguments.Length == 1) | ||
42 | { | ||
43 | var arg = assemblyAttribute.ConstructorArguments[0]; | ||
44 | if (arg.Value is INamedTypeSymbol argValue) | ||
45 | { | ||
46 | baFactoryClassName = argValue.ToDisplayString(symbolDisplayFormat); | ||
47 | break; | ||
48 | } | ||
49 | } | ||
50 | } | ||
51 | |||
52 | if (baFactoryClassName == null) | ||
53 | { | ||
54 | context.ReportDiagnostic(Diagnostic.Create(MissingFactoryAttributeDescriptor, null)); | ||
55 | } | ||
56 | else | ||
57 | { | ||
58 | var source = String.Format(Template, Version, baFactoryClassName); | ||
59 | context.AddSource("WixToolset.Dnc.Host.g.cs", SourceText.From(source, Encoding.UTF8, SourceHashAlgorithm.Sha256)); | ||
60 | } | ||
61 | } | ||
62 | |||
63 | public const string Template = @" | ||
64 | //------------------------------------------------------------------------------ | ||
65 | // <auto-generated> | ||
66 | // This code was generated by a tool. | ||
67 | // | ||
68 | // Changes to this file may cause incorrect behavior and will be lost if | ||
69 | // the code is regenerated. | ||
70 | // </auto-generated> | ||
71 | //------------------------------------------------------------------------------ | ||
72 | |||
73 | namespace WixToolset.Dnc.Host | ||
74 | {{ | ||
75 | using System; | ||
76 | using System.CodeDom.Compiler; | ||
77 | using System.Diagnostics.CodeAnalysis; | ||
78 | using System.Linq; | ||
79 | using System.Reflection; | ||
80 | using System.Runtime.CompilerServices; | ||
81 | using System.Runtime.InteropServices; | ||
82 | using WixToolset.Mba.Core; | ||
83 | |||
84 | [GeneratedCode(""WixToolset.Dnc.HostGenerator.DncHostGenerator"", ""{0}"")] | ||
85 | [CompilerGenerated] | ||
86 | delegate IBootstrapperApplicationFactory StaticEntryDelegate(); | ||
87 | |||
88 | /// <summary> | ||
89 | /// Entry point for the .NET Core host to create and return the BA to the engine. | ||
90 | /// </summary> | ||
91 | [GeneratedCode(""WixToolset.Dnc.HostGenerator.DncHostGenerator"", ""{0}"")] | ||
92 | [CompilerGenerated] | ||
93 | public sealed class BootstrapperApplicationFactory : IBootstrapperApplicationFactory | ||
94 | {{ | ||
95 | /// <summary> | ||
96 | /// Creates the bootstrapper application factory and calls its IBootstrapperApplicationFactory.Create method. | ||
97 | /// </summary> | ||
98 | /// <param name=""pArgs"">Pointer to BOOTSTRAPPER_CREATE_ARGS struct.</param> | ||
99 | /// <param name=""pResults"">Pointer to BOOTSTRAPPER_CREATE_RESULTS struct.</param> | ||
100 | public void Create(IntPtr pArgs, IntPtr pResults) | ||
101 | {{ | ||
102 | var baFactory = new {1}(); | ||
103 | baFactory.Create(pArgs, pResults); | ||
104 | }} | ||
105 | |||
106 | // Entry point for the DNC host. | ||
107 | public static IBootstrapperApplicationFactory CreateBAFactory() | ||
108 | {{ | ||
109 | return new BootstrapperApplicationFactory(); | ||
110 | }} | ||
111 | |||
112 | #if NET5_0_OR_GREATER | ||
113 | [ModuleInitializer] | ||
114 | [DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(BootstrapperApplicationFactory))] | ||
115 | #if NET5_0 | ||
116 | [DynamicDependency(""GetFunctionPointer(System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr,System.IntPtr)"", ""Internal.Runtime.InteropServices.ComponentActivator"", ""System.Private.CoreLib"")] | ||
117 | #endif | ||
118 | /// <summary> | ||
119 | /// Empty method to attach above attributes to support linker trimming. | ||
120 | /// </summary> | ||
121 | public static void ModuleInitialize() {{ }} | ||
122 | #endif | ||
123 | }} | ||
124 | }} | ||
125 | "; | ||
126 | } | ||
127 | } | ||
diff --git a/src/ext/Bal/WixToolset.Dnc.HostGenerator/WixToolset.Dnc.HostGenerator.csproj b/src/ext/Bal/WixToolset.Dnc.HostGenerator/WixToolset.Dnc.HostGenerator.csproj new file mode 100644 index 00000000..2c33ac3c --- /dev/null +++ b/src/ext/Bal/WixToolset.Dnc.HostGenerator/WixToolset.Dnc.HostGenerator.csproj | |||
@@ -0,0 +1,27 @@ | |||
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>netstandard2.0</TargetFramework> | ||
7 | <RootNamespace>WixToolset.Dnc.HostGenerator</RootNamespace> | ||
8 | <Description>WiX Toolset .NET Core BA Host Generator</Description> | ||
9 | <Title>WiX Toolset .NET Core BA Host Generator</Title> | ||
10 | <DebugType>embedded</DebugType> | ||
11 | <PlatformTarget>AnyCPU</PlatformTarget> | ||
12 | <GitThisAssembly>true</GitThisAssembly> | ||
13 | </PropertyGroup> | ||
14 | |||
15 | <ItemGroup> | ||
16 | <Content Include="build\$(AssemblyName).props" CopyToOutputDirectory="PreserveNewest" /> | ||
17 | <Content Include="build\$(AssemblyName).targets" CopyToOutputDirectory="PreserveNewest" /> | ||
18 | </ItemGroup> | ||
19 | |||
20 | <ItemGroup> | ||
21 | <PackageReference Include="Microsoft.CodeAnalysis.CSharp" PrivateAssets="all" /> | ||
22 | <PackageReference Include="Microsoft.CodeAnalysis.Analyzers"> | ||
23 | <PrivateAssets>all</PrivateAssets> | ||
24 | <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
25 | </PackageReference> | ||
26 | </ItemGroup> | ||
27 | </Project> | ||
diff --git a/src/ext/Bal/WixToolset.Dnc.HostGenerator/WixToolset.Dnc.HostGenerator.nuspec b/src/ext/Bal/WixToolset.Dnc.HostGenerator/WixToolset.Dnc.HostGenerator.nuspec new file mode 100644 index 00000000..46dd7248 --- /dev/null +++ b/src/ext/Bal/WixToolset.Dnc.HostGenerator/WixToolset.Dnc.HostGenerator.nuspec | |||
@@ -0,0 +1,23 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd"> | ||
3 | <metadata> | ||
4 | <id>$id$</id> | ||
5 | <version>$version$</version> | ||
6 | <title>$title$</title> | ||
7 | <description>$description$</description> | ||
8 | <authors>$authors$</authors> | ||
9 | <license type="expression">MS-RL</license> | ||
10 | <requireLicenseAcceptance>false</requireLicenseAcceptance> | ||
11 | <copyright>$copyright$</copyright> | ||
12 | <projectUrl>$projectUrl$</projectUrl> | ||
13 | <repository type="$repositorytype$" url="$repositoryurl$" commit="$repositorycommit$" /> | ||
14 | <dependencies> | ||
15 | <dependency id="WixToolset.Mba.Core" version="[$version$,5)" /> | ||
16 | </dependencies> | ||
17 | </metadata> | ||
18 | |||
19 | <files> | ||
20 | <file src="$id$.dll" target="analyzers/dotnet/cs" /> | ||
21 | <file src="build\**\*" target="build" /> | ||
22 | </files> | ||
23 | </package> | ||
diff --git a/src/ext/Bal/WixToolset.Dnc.HostGenerator/build/WixToolset.Dnc.HostGenerator.props b/src/ext/Bal/WixToolset.Dnc.HostGenerator/build/WixToolset.Dnc.HostGenerator.props new file mode 100644 index 00000000..f9306af7 --- /dev/null +++ b/src/ext/Bal/WixToolset.Dnc.HostGenerator/build/WixToolset.Dnc.HostGenerator.props | |||
@@ -0,0 +1,10 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
3 | |||
4 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="Current"> | ||
5 | <PropertyGroup> | ||
6 | <BuiltInComInteropSupport>true</BuiltInComInteropSupport> | ||
7 | <EnableDynamicLoading>true</EnableDynamicLoading> | ||
8 | <_EnableConsumingManagedCodeFromNativeHosting>true</_EnableConsumingManagedCodeFromNativeHosting> | ||
9 | </PropertyGroup> | ||
10 | </Project> | ||
diff --git a/src/ext/Bal/WixToolset.Dnc.HostGenerator/build/WixToolset.Dnc.HostGenerator.targets b/src/ext/Bal/WixToolset.Dnc.HostGenerator/build/WixToolset.Dnc.HostGenerator.targets new file mode 100644 index 00000000..d536ef5f --- /dev/null +++ b/src/ext/Bal/WixToolset.Dnc.HostGenerator/build/WixToolset.Dnc.HostGenerator.targets | |||
@@ -0,0 +1,11 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
3 | |||
4 | <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="Current"> | ||
5 | <ItemGroup Condition=" '$(TrimMode)'=='CopyUsed' "> | ||
6 | <TrimmerRootAssembly Include="System.Diagnostics.Tools" /> | ||
7 | <TrimmerRootAssembly Include="System.Runtime" /> | ||
8 | <TrimmerRootAssembly Include="System.Runtime.InteropServices" /> | ||
9 | <TrimmerRootAssembly Include="System.Runtime.Loader" /> | ||
10 | </ItemGroup> | ||
11 | </Project> | ||
diff --git a/src/ext/Bal/bal.cmd b/src/ext/Bal/bal.cmd index f8894f76..75f3502b 100644 --- a/src/ext/Bal/bal.cmd +++ b/src/ext/Bal/bal.cmd | |||
@@ -2,11 +2,12 @@ | |||
2 | @pushd %~dp0 | 2 | @pushd %~dp0 |
3 | 3 | ||
4 | @set _C=Debug | 4 | @set _C=Debug |
5 | @set _L=%~dp0..\..\..\build\logs | ||
5 | :parse_args | 6 | :parse_args |
6 | @if /i "%1"=="release" set _C=Release | 7 | @if /i "%1"=="release" set _C=Release |
7 | @if not "%1"=="" shift & goto parse_args | 8 | @if not "%1"=="" shift & goto parse_args |
8 | 9 | ||
9 | @echo Building ext\Util %_C% using %_N% | 10 | @echo Building ext\Bal %_C% using %_N% |
10 | 11 | ||
11 | :: Restore | 12 | :: Restore |
12 | nuget restore dnchost\packages.config || exit /b | 13 | nuget restore dnchost\packages.config || exit /b |
@@ -22,6 +23,9 @@ msbuild -p:Configuration=%_C%;Platform=x64 mbahost\mbahost.vcxproj || exit /b | |||
22 | msbuild -p:Configuration=%_C%;Platform=ARM64 mbahost\mbahost.vcxproj || exit /b | 23 | msbuild -p:Configuration=%_C%;Platform=ARM64 mbahost\mbahost.vcxproj || exit /b |
23 | 24 | ||
24 | msbuild -p:Configuration=%_C% || exit /b | 25 | msbuild -p:Configuration=%_C% || exit /b |
26 | |||
27 | dotnet test test\WixToolsetTest.Dnc.HostGenerator -c %_C% --nologo --no-build -l "trx;LogFileName=%_L%\TestResults\WixToolsetTest.Dnc.HostGenerator.trx" || exit /b | ||
28 | |||
25 | msbuild -p:Configuration=%_C% test\examples\examples.proj || exit /b | 29 | msbuild -p:Configuration=%_C% test\examples\examples.proj || exit /b |
26 | 30 | ||
27 | :: Test | 31 | :: Test |
@@ -31,6 +35,7 @@ dotnet test -c %_C% --no-build test\WixToolsetTest.Bal || exit /b | |||
31 | 35 | ||
32 | :: Pack | 36 | :: Pack |
33 | msbuild -t:Pack -p:Configuration=%_C% -p:NoBuild=true wixext\WixToolset.Bal.wixext.csproj || exit /b | 37 | msbuild -t:Pack -p:Configuration=%_C% -p:NoBuild=true wixext\WixToolset.Bal.wixext.csproj || exit /b |
38 | msbuild -t:Pack -p:Configuration=%_C% -p:NoBuild=true WixToolset.Dnc.HostGenerator\WixToolset.Dnc.HostGenerator.csproj || exit /b | ||
34 | msbuild -t:Pack -p:Configuration=%_C% -p:NoBuild=true WixToolset.Mba.Host\WixToolset.Mba.Host.csproj || exit /b | 39 | msbuild -t:Pack -p:Configuration=%_C% -p:NoBuild=true WixToolset.Mba.Host\WixToolset.Mba.Host.csproj || exit /b |
35 | 40 | ||
36 | @popd | 41 | @popd |
diff --git a/src/ext/Bal/dnchost/dnchost.cpp b/src/ext/Bal/dnchost/dnchost.cpp index 8ca326fc..dcc9fa56 100644 --- a/src/ext/Bal/dnchost/dnchost.cpp +++ b/src/ext/Bal/dnchost/dnchost.cpp | |||
@@ -154,9 +154,6 @@ static HRESULT LoadModulePaths( | |||
154 | hr = PathGetDirectory(pState->sczModuleFullPath, &pState->sczAppBase); | 154 | hr = PathGetDirectory(pState->sczModuleFullPath, &pState->sczAppBase); |
155 | BalExitOnFailure(hr, "Failed to get the directory of the full process path."); | 155 | BalExitOnFailure(hr, "Failed to get the directory of the full process path."); |
156 | 156 | ||
157 | hr = PathConcat(pState->sczAppBase, DNC_ASSEMBLY_FILE_NAME, &pState->sczManagedHostPath); | ||
158 | BalExitOnFailure(hr, "Failed to create managed host path."); | ||
159 | |||
160 | LExit: | 157 | LExit: |
161 | return hr; | 158 | return hr; |
162 | } | 159 | } |
@@ -249,7 +246,7 @@ static HRESULT LoadRuntime( | |||
249 | hr = DnchostLoadRuntime( | 246 | hr = DnchostLoadRuntime( |
250 | &pState->hostfxrState, | 247 | &pState->hostfxrState, |
251 | pState->sczModuleFullPath, | 248 | pState->sczModuleFullPath, |
252 | pState->sczManagedHostPath, | 249 | pState->sczBaFactoryAssemblyPath, |
253 | pState->sczBaFactoryDepsJsonPath, | 250 | pState->sczBaFactoryDepsJsonPath, |
254 | pState->sczBaFactoryRuntimeConfigPath); | 251 | pState->sczBaFactoryRuntimeConfigPath); |
255 | 252 | ||
diff --git a/src/ext/Bal/dnchost/dnchost.h b/src/ext/Bal/dnchost/dnchost.h index 22fd8f5e..b0ba9638 100644 --- a/src/ext/Bal/dnchost/dnchost.h +++ b/src/ext/Bal/dnchost/dnchost.h | |||
@@ -23,7 +23,6 @@ struct DNCSTATE | |||
23 | HINSTANCE hInstance; | 23 | HINSTANCE hInstance; |
24 | LPWSTR sczModuleFullPath; | 24 | LPWSTR sczModuleFullPath; |
25 | LPWSTR sczAppBase; | 25 | LPWSTR sczAppBase; |
26 | LPWSTR sczManagedHostPath; | ||
27 | LPWSTR sczBaFactoryAssemblyName; | 26 | LPWSTR sczBaFactoryAssemblyName; |
28 | LPWSTR sczBaFactoryAssemblyPath; | 27 | LPWSTR sczBaFactoryAssemblyPath; |
29 | LPWSTR sczBaFactoryDepsJsonPath; | 28 | LPWSTR sczBaFactoryDepsJsonPath; |
diff --git a/src/ext/Bal/dnchost/dnchost.vcxproj b/src/ext/Bal/dnchost/dnchost.vcxproj index 66e52c6f..1fd2ebed 100644 --- a/src/ext/Bal/dnchost/dnchost.vcxproj +++ b/src/ext/Bal/dnchost/dnchost.vcxproj | |||
@@ -81,14 +81,6 @@ | |||
81 | </ItemDefinitionGroup> | 81 | </ItemDefinitionGroup> |
82 | 82 | ||
83 | <ItemGroup> | 83 | <ItemGroup> |
84 | <ProjectReference Include="..\WixToolset.Dnc.Host\WixToolset.Dnc.Host.csproj"> | ||
85 | <Project>{0D780900-C2FF-4FA2-8CB5-8A19768724C5}</Project> | ||
86 | <ReferenceOutputAssembly>false</ReferenceOutputAssembly> | ||
87 | <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties> | ||
88 | </ProjectReference> | ||
89 | </ItemGroup> | ||
90 | |||
91 | <ItemGroup> | ||
92 | <PackageReference Include="WixToolset.BalUtil" /> | 84 | <PackageReference Include="WixToolset.BalUtil" /> |
93 | 85 | ||
94 | <PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" /> | 86 | <PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" /> |
diff --git a/src/ext/Bal/dnchost/dncutil.cpp b/src/ext/Bal/dnchost/dncutil.cpp index 34d14911..6486e6e9 100644 --- a/src/ext/Bal/dnchost/dncutil.cpp +++ b/src/ext/Bal/dnchost/dncutil.cpp | |||
@@ -2,6 +2,12 @@ | |||
2 | 2 | ||
3 | #include "precomp.h" | 3 | #include "precomp.h" |
4 | 4 | ||
5 | #define DNC_ENTRY_TYPE "WixToolset.Dnc.Host.BootstrapperApplicationFactory" | ||
6 | #define DNC_ENTRY_TYPEW L"WixToolset.Dnc.Host.BootstrapperApplicationFactory" | ||
7 | #define DNC_STATIC_ENTRY_METHOD "CreateBAFactory" | ||
8 | #define DNC_STATIC_ENTRY_METHODW L"CreateBAFactory" | ||
9 | #define DNC_STATIC_ENTRY_DELEGATEW L"WixToolset.Dnc.Host.StaticEntryDelegate" | ||
10 | |||
5 | // https://github.com/dotnet/runtime/blob/master/src/installer/corehost/error_codes.h | 11 | // https://github.com/dotnet/runtime/blob/master/src/installer/corehost/error_codes.h |
6 | #define InvalidArgFailure 0x80008081 | 12 | #define InvalidArgFailure 0x80008081 |
7 | #define HostApiBufferTooSmall 0x80008098 | 13 | #define HostApiBufferTooSmall 0x80008098 |
@@ -74,19 +80,28 @@ LExit: | |||
74 | HRESULT DnchostCreateFactory( | 80 | HRESULT DnchostCreateFactory( |
75 | __in HOSTFXR_STATE* pState, | 81 | __in HOSTFXR_STATE* pState, |
76 | __in LPCWSTR wzBaFactoryAssemblyName, | 82 | __in LPCWSTR wzBaFactoryAssemblyName, |
77 | __in LPCWSTR wzBaFactoryAssemblyPath, | 83 | __in LPCWSTR /*wzBaFactoryAssemblyPath*/, |
78 | __out IBootstrapperApplicationFactory** ppAppFactory | 84 | __out IBootstrapperApplicationFactory** ppAppFactory |
79 | ) | 85 | ) |
80 | { | 86 | { |
81 | HRESULT hr = S_OK; | 87 | HRESULT hr = S_OK; |
82 | PFNCREATEBAFACTORY pfnCreateBAFactory = NULL; | 88 | PFNCREATEBAFACTORY pfnCreateBAFactory = NULL; |
89 | LPWSTR sczEntryType = NULL; | ||
90 | LPWSTR sczEntryDelegate = NULL; | ||
91 | LPSTR sczBaFactoryAssemblyName = NULL; | ||
83 | 92 | ||
84 | if (pState->pfnGetFunctionPointer) | 93 | if (pState->pfnGetFunctionPointer) |
85 | { | 94 | { |
95 | hr = StrAllocFormatted(&sczEntryType, L"%ls,%ls", DNC_ENTRY_TYPEW, wzBaFactoryAssemblyName); | ||
96 | BalExitOnFailure(hr, "Failed to format entry type."); | ||
97 | |||
98 | hr = StrAllocFormatted(&sczEntryDelegate, L"%ls,%ls", DNC_STATIC_ENTRY_DELEGATEW, wzBaFactoryAssemblyName); | ||
99 | BalExitOnFailure(hr, "Failed to format entry delegate."); | ||
100 | |||
86 | hr = pState->pfnGetFunctionPointer( | 101 | hr = pState->pfnGetFunctionPointer( |
87 | DNC_ENTRY_TYPEW, | 102 | sczEntryType, |
88 | DNC_STATIC_ENTRY_METHODW, | 103 | DNC_STATIC_ENTRY_METHODW, |
89 | DNC_STATIC_ENTRY_DELEGATEW, | 104 | sczEntryDelegate, |
90 | NULL, | 105 | NULL, |
91 | NULL, | 106 | NULL, |
92 | reinterpret_cast<void**>(&pfnCreateBAFactory)); | 107 | reinterpret_cast<void**>(&pfnCreateBAFactory)); |
@@ -94,19 +109,26 @@ HRESULT DnchostCreateFactory( | |||
94 | } | 109 | } |
95 | else | 110 | else |
96 | { | 111 | { |
112 | hr = StrAnsiAllocString(&sczBaFactoryAssemblyName, wzBaFactoryAssemblyName, 0, CP_UTF8); | ||
113 | BalExitOnFailure(hr, "Failed to convert assembly name to UTF8: %ls", wzBaFactoryAssemblyName); | ||
114 | |||
97 | hr = pState->pfnCoreclrCreateDelegate( | 115 | hr = pState->pfnCoreclrCreateDelegate( |
98 | pState->pClrHandle, | 116 | pState->pClrHandle, |
99 | pState->dwDomainId, | 117 | pState->dwDomainId, |
100 | DNC_ASSEMBLY_FULL_NAME, | 118 | sczBaFactoryAssemblyName, |
101 | DNC_ENTRY_TYPE, | 119 | DNC_ENTRY_TYPE, |
102 | DNC_STATIC_ENTRY_METHOD, | 120 | DNC_STATIC_ENTRY_METHOD, |
103 | reinterpret_cast<void**>(&pfnCreateBAFactory)); | 121 | reinterpret_cast<void**>(&pfnCreateBAFactory)); |
104 | BalExitOnFailure(hr, "Failed to create delegate in app domain."); | 122 | BalExitOnFailure(hr, "Failed to create delegate in app domain."); |
105 | } | 123 | } |
106 | 124 | ||
107 | *ppAppFactory = pfnCreateBAFactory(wzBaFactoryAssemblyName, wzBaFactoryAssemblyPath); | 125 | *ppAppFactory = pfnCreateBAFactory(); |
108 | 126 | ||
109 | LExit: | 127 | LExit: |
128 | ReleaseStr(sczEntryType); | ||
129 | ReleaseStr(sczEntryDelegate); | ||
130 | ReleaseStr(sczBaFactoryAssemblyName); | ||
131 | |||
110 | return hr; | 132 | return hr; |
111 | } | 133 | } |
112 | 134 | ||
@@ -233,7 +255,7 @@ static HRESULT InitializeCoreClr( | |||
233 | } | 255 | } |
234 | else | 256 | else |
235 | { | 257 | { |
236 | ExitOnFailure(hr, "HostfxrGetRuntimeDelegate failed"); | 258 | BalExitOnFailure(hr, "HostfxrGetRuntimeDelegate failed"); |
237 | } | 259 | } |
238 | 260 | ||
239 | LExit: | 261 | LExit: |
@@ -295,6 +317,8 @@ static HRESULT InitializeCoreClrPre5( | |||
295 | 317 | ||
296 | for (DWORD i = 0; i < cDirectories; ++i) | 318 | for (DWORD i = 0; i < cDirectories; ++i) |
297 | { | 319 | { |
320 | Assert(rgDirectories); | ||
321 | |||
298 | hr = PathConcat(rgDirectories[i], L"coreclr.dll", &sczCoreClrPath); | 322 | hr = PathConcat(rgDirectories[i], L"coreclr.dll", &sczCoreClrPath); |
299 | BalExitOnFailure(hr, "Failed to allocate path to coreclr."); | 323 | BalExitOnFailure(hr, "Failed to allocate path to coreclr."); |
300 | 324 | ||
@@ -324,9 +348,9 @@ static HRESULT InitializeCoreClrPre5( | |||
324 | BalExitOnFailure(hr, "Failed to start coreclr."); | 348 | BalExitOnFailure(hr, "Failed to start coreclr."); |
325 | 349 | ||
326 | LExit: | 350 | LExit: |
327 | MemFree(rgDirectories); | 351 | ReleaseMem(rgDirectories); |
328 | MemFree(rgPropertyValues); | 352 | ReleaseMem(rgPropertyValues); |
329 | MemFree(rgPropertyKeys); | 353 | ReleaseMem(rgPropertyKeys); |
330 | ReleaseStr(sczCoreClrPath); | 354 | ReleaseStr(sczCoreClrPath); |
331 | 355 | ||
332 | return hr; | 356 | return hr; |
diff --git a/src/ext/Bal/dnchost/dncutil.h b/src/ext/Bal/dnchost/dncutil.h index 85eda3b2..f88e3f77 100644 --- a/src/ext/Bal/dnchost/dncutil.h +++ b/src/ext/Bal/dnchost/dncutil.h | |||
@@ -1,10 +1,7 @@ | |||
1 | #pragma once | 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. | 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 | typedef IBootstrapperApplicationFactory* (STDMETHODCALLTYPE* PFNCREATEBAFACTORY)( | 4 | typedef IBootstrapperApplicationFactory* (STDMETHODCALLTYPE* PFNCREATEBAFACTORY)(); |
5 | __in LPCWSTR wzBaFactoryAssemblyName, | ||
6 | __in LPCWSTR wzBaFactoryAssemblyPath | ||
7 | ); | ||
8 | 5 | ||
9 | struct HOSTFXR_STATE | 6 | struct HOSTFXR_STATE |
10 | { | 7 | { |
diff --git a/src/ext/Bal/dnchost/precomp.h b/src/ext/Bal/dnchost/precomp.h index 84ff6424..7aefc4e3 100644 --- a/src/ext/Bal/dnchost/precomp.h +++ b/src/ext/Bal/dnchost/precomp.h | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <IBootstrapperApplicationFactory.h> | 20 | #include <IBootstrapperApplicationFactory.h> |
21 | #include <balutil.h> | 21 | #include <balutil.h> |
22 | 22 | ||
23 | #include <WixToolset.Dnc.Host.h> | ||
24 | #define NETHOST_USE_AS_STATIC | 23 | #define NETHOST_USE_AS_STATIC |
25 | #include <nethost.h> | 24 | #include <nethost.h> |
26 | #include <hostfxr.h> | 25 | #include <hostfxr.h> |
diff --git a/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/CSharpSourceGeneratorVerifier.cs b/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/CSharpSourceGeneratorVerifier.cs new file mode 100644 index 00000000..27729ac8 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/CSharpSourceGeneratorVerifier.cs | |||
@@ -0,0 +1,45 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolsetTest.Dnc.HostGenerator | ||
4 | { | ||
5 | using System; | ||
6 | using System.Collections.Immutable; | ||
7 | using Microsoft.CodeAnalysis; | ||
8 | using Microsoft.CodeAnalysis.CSharp; | ||
9 | using Microsoft.CodeAnalysis.CSharp.Testing; | ||
10 | using Microsoft.CodeAnalysis.Testing.Verifiers; | ||
11 | |||
12 | public static class CSharpSourceGeneratorVerifier<TSourceGenerator> | ||
13 | where TSourceGenerator : ISourceGenerator, new() | ||
14 | { | ||
15 | public class Test : CSharpSourceGeneratorTest<TSourceGenerator, XUnitVerifier> | ||
16 | { | ||
17 | public Test() | ||
18 | { | ||
19 | } | ||
20 | |||
21 | protected override CompilationOptions CreateCompilationOptions() | ||
22 | { | ||
23 | var compilationOptions = base.CreateCompilationOptions(); | ||
24 | return compilationOptions.WithSpecificDiagnosticOptions( | ||
25 | compilationOptions.SpecificDiagnosticOptions.SetItems(GetNullableWarningsFromCompiler())); | ||
26 | } | ||
27 | |||
28 | public LanguageVersion LanguageVersion { get; set; } = LanguageVersion.Default; | ||
29 | |||
30 | private static ImmutableDictionary<string, ReportDiagnostic> GetNullableWarningsFromCompiler() | ||
31 | { | ||
32 | string[] args = { "/warnaserror:nullable" }; | ||
33 | var commandLineArguments = CSharpCommandLineParser.Default.Parse(args, baseDirectory: Environment.CurrentDirectory, sdkDirectory: Environment.CurrentDirectory); | ||
34 | var nullableWarnings = commandLineArguments.CompilationOptions.SpecificDiagnosticOptions; | ||
35 | |||
36 | return nullableWarnings; | ||
37 | } | ||
38 | |||
39 | protected override ParseOptions CreateParseOptions() | ||
40 | { | ||
41 | return ((CSharpParseOptions)base.CreateParseOptions()).WithLanguageVersion(this.LanguageVersion); | ||
42 | } | ||
43 | } | ||
44 | } | ||
45 | } | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/DncHostGeneratorTests.cs b/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/DncHostGeneratorTests.cs new file mode 100644 index 00000000..6ede1089 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/DncHostGeneratorTests.cs | |||
@@ -0,0 +1,88 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolsetTest.Dnc.HostGenerator | ||
4 | { | ||
5 | using System; | ||
6 | using System.Text; | ||
7 | using System.Threading.Tasks; | ||
8 | using Microsoft.CodeAnalysis; | ||
9 | using Microsoft.CodeAnalysis.Testing; | ||
10 | using Microsoft.CodeAnalysis.Text; | ||
11 | using WixToolset.Dnc.HostGenerator; | ||
12 | using WixToolset.Mba.Core; | ||
13 | using Xunit; | ||
14 | |||
15 | using VerifyCS = CSharpSourceGeneratorVerifier<WixToolset.Dnc.HostGenerator.DncHostGenerator>; | ||
16 | |||
17 | public class DncHostGeneratorTests | ||
18 | { | ||
19 | static readonly MetadataReference MbaCoreAssembly = MetadataReference.CreateFromFile(typeof(BootstrapperApplicationFactoryAttribute).Assembly.Location); | ||
20 | |||
21 | [Fact] | ||
22 | public async Task FailsBuildWhenMissingAttribute() | ||
23 | { | ||
24 | var code = @" | ||
25 | //[assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Test.BAFactory))] | ||
26 | namespace Test | ||
27 | { | ||
28 | using WixToolset.Mba.Core; | ||
29 | |||
30 | public class BAFactory : BaseBootstrapperApplicationFactory | ||
31 | { | ||
32 | protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) | ||
33 | { | ||
34 | return null; | ||
35 | } | ||
36 | } | ||
37 | } | ||
38 | "; | ||
39 | |||
40 | await new VerifyCS.Test | ||
41 | { | ||
42 | TestState = | ||
43 | { | ||
44 | Sources = { code }, | ||
45 | AdditionalReferences = { MbaCoreAssembly }, | ||
46 | ExpectedDiagnostics = | ||
47 | { | ||
48 | new DiagnosticResult(DncHostGenerator.MissingFactoryAttributeDescriptor), | ||
49 | }, | ||
50 | }, | ||
51 | }.RunAsync(); | ||
52 | } | ||
53 | |||
54 | [Fact] | ||
55 | public async Task GeneratesEntryPoint() | ||
56 | { | ||
57 | var code = @" | ||
58 | [assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Test.BAFactory))] | ||
59 | namespace Test | ||
60 | { | ||
61 | using WixToolset.Mba.Core; | ||
62 | |||
63 | public class BAFactory : BaseBootstrapperApplicationFactory | ||
64 | { | ||
65 | protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) | ||
66 | { | ||
67 | return null; | ||
68 | } | ||
69 | } | ||
70 | } | ||
71 | "; | ||
72 | var generated = String.Format(DncHostGenerator.Template, DncHostGenerator.Version, "Test.BAFactory"); | ||
73 | |||
74 | await new VerifyCS.Test | ||
75 | { | ||
76 | TestState = | ||
77 | { | ||
78 | Sources = { code }, | ||
79 | GeneratedSources = | ||
80 | { | ||
81 | (typeof(DncHostGenerator), "WixToolset.Dnc.Host.g.cs", SourceText.From(generated, Encoding.UTF8, SourceHashAlgorithm.Sha256)), | ||
82 | }, | ||
83 | AdditionalReferences = { MbaCoreAssembly }, | ||
84 | }, | ||
85 | }.RunAsync(); | ||
86 | } | ||
87 | } | ||
88 | } | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/WixToolsetTest.Dnc.HostGenerator.csproj b/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/WixToolsetTest.Dnc.HostGenerator.csproj new file mode 100644 index 00000000..0c2b33fd --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Dnc.HostGenerator/WixToolsetTest.Dnc.HostGenerator.csproj | |||
@@ -0,0 +1,27 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
3 | |||
4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
5 | <PropertyGroup> | ||
6 | <TargetFramework>netcoreapp3.1</TargetFramework> | ||
7 | <IsPackable>false</IsPackable> | ||
8 | <SignOutput>false</SignOutput> | ||
9 | </PropertyGroup> | ||
10 | |||
11 | <ItemGroup> | ||
12 | <ProjectReference Include="..\..\WixToolset.Dnc.HostGenerator\WixToolset.Dnc.HostGenerator.csproj" /> | ||
13 | </ItemGroup> | ||
14 | |||
15 | <ItemGroup> | ||
16 | <PackageReference Include="WixBuildTools.TestSupport" /> | ||
17 | <PackageReference Include="WixToolset.Mba.Core" /> | ||
18 | </ItemGroup> | ||
19 | |||
20 | <ItemGroup> | ||
21 | <PackageReference Include="Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.XUnit" /> | ||
22 | <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" /> | ||
23 | <PackageReference Include="Microsoft.NET.Test.Sdk" /> | ||
24 | <PackageReference Include="xunit" /> | ||
25 | <PackageReference Include="xunit.runner.visualstudio" PrivateAssets="All" /> | ||
26 | </ItemGroup> | ||
27 | </Project> | ||
diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs index 8dd5ff11..14b80fe8 100644 --- a/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs +++ b/src/ext/Bal/test/WixToolsetTest.ManagedHost/DncHostFixture.cs | |||
@@ -2,9 +2,7 @@ | |||
2 | 2 | ||
3 | namespace WixToolsetTest.ManagedHost | 3 | namespace WixToolsetTest.ManagedHost |
4 | { | 4 | { |
5 | using System.IO; | ||
6 | using WixBuildTools.TestSupport; | 5 | using WixBuildTools.TestSupport; |
7 | using WixToolset.Core.TestPackage; | ||
8 | using Xunit; | 6 | using Xunit; |
9 | 7 | ||
10 | public class DncHostFixture | 8 | public class DncHostFixture |
@@ -21,11 +19,13 @@ namespace WixToolsetTest.ManagedHost | |||
21 | var testEngine = new TestEngine(); | 19 | var testEngine = new TestEngine(); |
22 | 20 | ||
23 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | 21 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); |
24 | var logMessages = result.Output; | 22 | WixAssert.CompareLineByLine(new[] |
25 | Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[0]); | 23 | { |
26 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | 24 | "Loading .NET Core FDD bootstrapper application.", |
27 | Assert.Equal("EarliestCoreBA", logMessages[2]); | 25 | "Creating BA thread to run asynchronously.", |
28 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | 26 | "EarliestCoreBA", |
27 | "Shutdown,ReloadBootstrapper,0", | ||
28 | }, result.Output.ToArray()); | ||
29 | } | 29 | } |
30 | } | 30 | } |
31 | 31 | ||
@@ -39,14 +39,17 @@ namespace WixToolsetTest.ManagedHost | |||
39 | var testEngine = new TestEngine(); | 39 | var testEngine = new TestEngine(); |
40 | 40 | ||
41 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | 41 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); |
42 | var logMessages = result.Output; | 42 | WixAssert.CompareLineByLine(new[] |
43 | Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); | 43 | { |
44 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | 44 | "Loading .NET Core SCD bootstrapper application.", |
45 | Assert.Equal("EarliestCoreBA", logMessages[2]); | 45 | "Creating BA thread to run asynchronously.", |
46 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | 46 | "EarliestCoreBA", |
47 | "Shutdown,ReloadBootstrapper,0", | ||
48 | }, result.Output.ToArray()); | ||
47 | } | 49 | } |
48 | } | 50 | } |
49 | 51 | ||
52 | [Fact] | ||
50 | public void CanLoadTrimmedSCDEarliestCoreMBA() | 53 | public void CanLoadTrimmedSCDEarliestCoreMBA() |
51 | { | 54 | { |
52 | using (var fs = new DisposableFileSystem()) | 55 | using (var fs = new DisposableFileSystem()) |
@@ -56,11 +59,13 @@ namespace WixToolsetTest.ManagedHost | |||
56 | var testEngine = new TestEngine(); | 59 | var testEngine = new TestEngine(); |
57 | 60 | ||
58 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | 61 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); |
59 | var logMessages = result.Output; | 62 | WixAssert.CompareLineByLine(new[] |
60 | Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); | 63 | { |
61 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | 64 | "Loading .NET Core SCD bootstrapper application.", |
62 | Assert.Equal("EarliestCoreBA", logMessages[2]); | 65 | "Creating BA thread to run asynchronously.", |
63 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | 66 | "EarliestCoreBA", |
67 | "Shutdown,ReloadBootstrapper,0", | ||
68 | }, result.Output.ToArray()); | ||
64 | } | 69 | } |
65 | } | 70 | } |
66 | 71 | ||
@@ -74,16 +79,19 @@ namespace WixToolsetTest.ManagedHost | |||
74 | var testEngine = new TestEngine(); | 79 | var testEngine = new TestEngine(); |
75 | 80 | ||
76 | var result = testEngine.RunReloadEngine(bundleFile, baseFolder); | 81 | var result = testEngine.RunReloadEngine(bundleFile, baseFolder); |
77 | var logMessages = result.Output; | 82 | WixAssert.CompareLineByLine(new[] |
78 | Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); | 83 | { |
79 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | 84 | "Loading .NET Core SCD bootstrapper application.", |
80 | Assert.Equal("EarliestCoreBA", logMessages[2]); | 85 | "Creating BA thread to run asynchronously.", |
81 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | 86 | "EarliestCoreBA", |
82 | Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[4]); | 87 | "Shutdown,ReloadBootstrapper,0", |
83 | Assert.Equal("Reloaded 1 time(s)", logMessages[5]); // dnchost doesn't currently support unloading | 88 | "Loading .NET Core SCD bootstrapper application.", |
84 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[6]); | 89 | "Reloaded 1 time(s)", // dnchost doesn't currently support unloading |
85 | Assert.Equal("EarliestCoreBA", logMessages[7]); | 90 | "Creating BA thread to run asynchronously.", |
86 | Assert.Equal("Shutdown,Restart,0", logMessages[8]); | 91 | "EarliestCoreBA", |
92 | "Shutdown,Restart,0", | ||
93 | |||
94 | }, result.Output.ToArray()); | ||
87 | } | 95 | } |
88 | } | 96 | } |
89 | 97 | ||
@@ -97,11 +105,13 @@ namespace WixToolsetTest.ManagedHost | |||
97 | var testEngine = new TestEngine(); | 105 | var testEngine = new TestEngine(); |
98 | 106 | ||
99 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | 107 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); |
100 | var logMessages = result.Output; | 108 | WixAssert.CompareLineByLine(new[] |
101 | Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[0]); | 109 | { |
102 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | 110 | "Loading .NET Core FDD bootstrapper application.", |
103 | Assert.Equal("LatestCoreBA", logMessages[2]); | 111 | "Creating BA thread to run asynchronously.", |
104 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | 112 | "LatestCoreBA", |
113 | "Shutdown,ReloadBootstrapper,0", | ||
114 | }, result.Output.ToArray()); | ||
105 | } | 115 | } |
106 | } | 116 | } |
107 | 117 | ||
@@ -115,16 +125,18 @@ namespace WixToolsetTest.ManagedHost | |||
115 | var testEngine = new TestEngine(); | 125 | var testEngine = new TestEngine(); |
116 | 126 | ||
117 | var result = testEngine.RunReloadEngine(bundleFile, baseFolder); | 127 | var result = testEngine.RunReloadEngine(bundleFile, baseFolder); |
118 | var logMessages = result.Output; | 128 | WixAssert.CompareLineByLine(new[] |
119 | Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[0]); | 129 | { |
120 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | 130 | "Loading .NET Core FDD bootstrapper application.", |
121 | Assert.Equal("LatestCoreBA", logMessages[2]); | 131 | "Creating BA thread to run asynchronously.", |
122 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | 132 | "LatestCoreBA", |
123 | Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[4]); | 133 | "Shutdown,ReloadBootstrapper,0", |
124 | Assert.Equal("Reloaded 1 time(s)", logMessages[5]); // dnchost doesn't currently support unloading | 134 | "Loading .NET Core FDD bootstrapper application.", |
125 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[6]); | 135 | "Reloaded 1 time(s)", // dnchost doesn't currently support unloading |
126 | Assert.Equal("LatestCoreBA", logMessages[7]); | 136 | "Creating BA thread to run asynchronously.", |
127 | Assert.Equal("Shutdown,Restart,0", logMessages[8]); | 137 | "LatestCoreBA", |
138 | "Shutdown,Restart,0", | ||
139 | }, result.Output.ToArray()); | ||
128 | } | 140 | } |
129 | } | 141 | } |
130 | 142 | ||
@@ -138,11 +150,14 @@ namespace WixToolsetTest.ManagedHost | |||
138 | var testEngine = new TestEngine(); | 150 | var testEngine = new TestEngine(); |
139 | 151 | ||
140 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | 152 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); |
153 | WixAssert.CompareLineByLine(new[] | ||
154 | { | ||
155 | "Loading .NET Core SCD bootstrapper application.", | ||
156 | "Creating BA thread to run asynchronously.", | ||
157 | "LatestCoreBA", | ||
158 | "Shutdown,ReloadBootstrapper,0", | ||
159 | }, result.Output.ToArray()); | ||
141 | var logMessages = result.Output; | 160 | var logMessages = result.Output; |
142 | Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); | ||
143 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | ||
144 | Assert.Equal("LatestCoreBA", logMessages[2]); | ||
145 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | ||
146 | } | 161 | } |
147 | } | 162 | } |
148 | 163 | ||
@@ -156,11 +171,13 @@ namespace WixToolsetTest.ManagedHost | |||
156 | var testEngine = new TestEngine(); | 171 | var testEngine = new TestEngine(); |
157 | 172 | ||
158 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | 173 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); |
159 | var logMessages = result.Output; | 174 | WixAssert.CompareLineByLine(new[] |
160 | Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); | 175 | { |
161 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | 176 | "Loading .NET Core SCD bootstrapper application.", |
162 | Assert.Equal("LatestCoreBA", logMessages[2]); | 177 | "Creating BA thread to run asynchronously.", |
163 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | 178 | "LatestCoreBA", |
179 | "Shutdown,ReloadBootstrapper,0", | ||
180 | }, result.Output.ToArray()); | ||
164 | } | 181 | } |
165 | } | 182 | } |
166 | 183 | ||
@@ -174,16 +191,18 @@ namespace WixToolsetTest.ManagedHost | |||
174 | var testEngine = new TestEngine(); | 191 | var testEngine = new TestEngine(); |
175 | 192 | ||
176 | var result = testEngine.RunReloadEngine(bundleFile, baseFolder); | 193 | var result = testEngine.RunReloadEngine(bundleFile, baseFolder); |
177 | var logMessages = result.Output; | 194 | WixAssert.CompareLineByLine(new[] |
178 | Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[0]); | 195 | { |
179 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | 196 | "Loading .NET Core SCD bootstrapper application.", |
180 | Assert.Equal("LatestCoreBA", logMessages[2]); | 197 | "Creating BA thread to run asynchronously.", |
181 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | 198 | "LatestCoreBA", |
182 | Assert.Equal("Loading .NET Core SCD bootstrapper application.", logMessages[4]); | 199 | "Shutdown,ReloadBootstrapper,0", |
183 | Assert.Equal("Reloaded 1 time(s)", logMessages[5]); // dnchost doesn't currently support unloading | 200 | "Loading .NET Core SCD bootstrapper application.", |
184 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[6]); | 201 | "Reloaded 1 time(s)", // dnchost doesn't currently support unloading |
185 | Assert.Equal("LatestCoreBA", logMessages[7]); | 202 | "Creating BA thread to run asynchronously.", |
186 | Assert.Equal("Shutdown,Restart,0", logMessages[8]); | 203 | "LatestCoreBA", |
204 | "Shutdown,Restart,0", | ||
205 | }, result.Output.ToArray()); | ||
187 | } | 206 | } |
188 | } | 207 | } |
189 | 208 | ||
@@ -197,11 +216,13 @@ namespace WixToolsetTest.ManagedHost | |||
197 | var testEngine = new TestEngine(); | 216 | var testEngine = new TestEngine(); |
198 | 217 | ||
199 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | 218 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); |
200 | var logMessages = result.Output; | 219 | WixAssert.CompareLineByLine(new[] |
201 | Assert.Equal("Loading .NET Core FDD bootstrapper application.", logMessages[0]); | 220 | { |
202 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | 221 | "Loading .NET Core FDD bootstrapper application.", |
203 | Assert.Equal("WPFCoreBA", logMessages[2]); | 222 | "Creating BA thread to run asynchronously.", |
204 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | 223 | "WPFCoreBA", |
224 | "Shutdown,ReloadBootstrapper,0", | ||
225 | }, result.Output.ToArray()); | ||
205 | } | 226 | } |
206 | } | 227 | } |
207 | } | 228 | } |
diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs index dd37ee58..b4ebe1c6 100644 --- a/src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs +++ b/src/ext/Bal/test/WixToolsetTest.ManagedHost/MbaHostFixture.cs | |||
@@ -2,9 +2,7 @@ | |||
2 | 2 | ||
3 | namespace WixToolsetTest.ManagedHost | 3 | namespace WixToolsetTest.ManagedHost |
4 | { | 4 | { |
5 | using System.IO; | ||
6 | using WixBuildTools.TestSupport; | 5 | using WixBuildTools.TestSupport; |
7 | using WixToolset.Core.TestPackage; | ||
8 | using Xunit; | 6 | using Xunit; |
9 | 7 | ||
10 | public class MbaHostFixture | 8 | public class MbaHostFixture |
@@ -21,11 +19,13 @@ namespace WixToolsetTest.ManagedHost | |||
21 | var testEngine = new TestEngine(); | 19 | var testEngine = new TestEngine(); |
22 | 20 | ||
23 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | 21 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); |
24 | var logMessages = result.Output; | 22 | WixAssert.CompareLineByLine(new[] |
25 | Assert.Equal("Loading managed bootstrapper application.", logMessages[0]); | 23 | { |
26 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | 24 | "Loading managed bootstrapper application.", |
27 | Assert.Equal("FullFramework2BA", logMessages[2]); | 25 | "Creating BA thread to run asynchronously.", |
28 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | 26 | "FullFramework2BA", |
27 | "Shutdown,ReloadBootstrapper,0", | ||
28 | }, result.Output.ToArray()); | ||
29 | } | 29 | } |
30 | } | 30 | } |
31 | 31 | ||
@@ -39,11 +39,13 @@ namespace WixToolsetTest.ManagedHost | |||
39 | var testEngine = new TestEngine(); | 39 | var testEngine = new TestEngine(); |
40 | 40 | ||
41 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); | 41 | var result = testEngine.RunShutdownEngine(bundleFile, baseFolder); |
42 | var logMessages = result.Output; | 42 | WixAssert.CompareLineByLine(new[] |
43 | Assert.Equal("Loading managed bootstrapper application.", logMessages[0]); | 43 | { |
44 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | 44 | "Loading managed bootstrapper application.", |
45 | Assert.Equal("FullFramework4BA", logMessages[2]); | 45 | "Creating BA thread to run asynchronously.", |
46 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | 46 | "FullFramework4BA", |
47 | "Shutdown,ReloadBootstrapper,0", | ||
48 | }, result.Output.ToArray()); | ||
47 | } | 49 | } |
48 | } | 50 | } |
49 | 51 | ||
@@ -57,15 +59,17 @@ namespace WixToolsetTest.ManagedHost | |||
57 | var testEngine = new TestEngine(); | 59 | var testEngine = new TestEngine(); |
58 | 60 | ||
59 | var result = testEngine.RunReloadEngine(bundleFile, baseFolder); | 61 | var result = testEngine.RunReloadEngine(bundleFile, baseFolder); |
60 | var logMessages = result.Output; | 62 | WixAssert.CompareLineByLine(new[] |
61 | Assert.Equal("Loading managed bootstrapper application.", logMessages[0]); | 63 | { |
62 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | 64 | "Loading managed bootstrapper application.", |
63 | Assert.Equal("FullFramework2BA", logMessages[2]); | 65 | "Creating BA thread to run asynchronously.", |
64 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | 66 | "FullFramework2BA", |
65 | Assert.Equal("Loading managed bootstrapper application.", logMessages[4]); | 67 | "Shutdown,ReloadBootstrapper,0", |
66 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[5]); | 68 | "Loading managed bootstrapper application.", |
67 | Assert.Equal("FullFramework2BA", logMessages[6]); | 69 | "Creating BA thread to run asynchronously.", |
68 | Assert.Equal("Shutdown,Restart,0", logMessages[7]); | 70 | "FullFramework2BA", |
71 | "Shutdown,Restart,0", | ||
72 | }, result.Output.ToArray()); | ||
69 | } | 73 | } |
70 | } | 74 | } |
71 | 75 | ||
@@ -79,15 +83,17 @@ namespace WixToolsetTest.ManagedHost | |||
79 | var testEngine = new TestEngine(); | 83 | var testEngine = new TestEngine(); |
80 | 84 | ||
81 | var result = testEngine.RunReloadEngine(bundleFile, baseFolder); | 85 | var result = testEngine.RunReloadEngine(bundleFile, baseFolder); |
82 | var logMessages = result.Output; | 86 | WixAssert.CompareLineByLine(new[] |
83 | Assert.Equal("Loading managed bootstrapper application.", logMessages[0]); | 87 | { |
84 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[1]); | 88 | "Loading managed bootstrapper application.", |
85 | Assert.Equal("FullFramework4BA", logMessages[2]); | 89 | "Creating BA thread to run asynchronously.", |
86 | Assert.Equal("Shutdown,ReloadBootstrapper,0", logMessages[3]); | 90 | "FullFramework4BA", |
87 | Assert.Equal("Loading managed bootstrapper application.", logMessages[4]); | 91 | "Shutdown,ReloadBootstrapper,0", |
88 | Assert.Equal("Creating BA thread to run asynchronously.", logMessages[5]); | 92 | "Loading managed bootstrapper application.", |
89 | Assert.Equal("FullFramework4BA", logMessages[6]); | 93 | "Creating BA thread to run asynchronously.", |
90 | Assert.Equal("Shutdown,Restart,0", logMessages[7]); | 94 | "FullFramework4BA", |
95 | "Shutdown,Restart,0", | ||
96 | }, result.Output.ToArray()); | ||
91 | } | 97 | } |
92 | } | 98 | } |
93 | } | 99 | } |
diff --git a/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs b/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs index 9d7fc9db..30d97f3e 100644 --- a/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs +++ b/src/ext/Bal/test/WixToolsetTest.ManagedHost/TestEngine.cs | |||
@@ -2,6 +2,7 @@ | |||
2 | 2 | ||
3 | namespace WixToolsetTest.ManagedHost | 3 | namespace WixToolsetTest.ManagedHost |
4 | { | 4 | { |
5 | using System; | ||
5 | using System.Collections.Generic; | 6 | using System.Collections.Generic; |
6 | using System.Diagnostics; | 7 | using System.Diagnostics; |
7 | using System.IO; | 8 | using System.IO; |
@@ -41,7 +42,7 @@ namespace WixToolsetTest.ManagedHost | |||
41 | { | 42 | { |
42 | var startInfo = new ProcessStartInfo(executablePath) | 43 | var startInfo = new ProcessStartInfo(executablePath) |
43 | { | 44 | { |
44 | Arguments = string.Join(' ', arguments), | 45 | Arguments = String.Join(' ', arguments), |
45 | CreateNoWindow = true, | 46 | CreateNoWindow = true, |
46 | RedirectStandardError = true, | 47 | RedirectStandardError = true, |
47 | RedirectStandardOutput = true, | 48 | RedirectStandardOutput = true, |
diff --git a/src/ext/Bal/test/examples/Directory.Build.props b/src/ext/Bal/test/examples/Directory.Build.props index 52b931f6..7f38564a 100644 --- a/src/ext/Bal/test/examples/Directory.Build.props +++ b/src/ext/Bal/test/examples/Directory.Build.props | |||
@@ -2,5 +2,6 @@ | |||
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 | <Project> | 3 | <Project> |
4 | <Import Project="$(MsbuildThisFileDirectory)..\..\Directory.Build.props" /> | 4 | <Import Project="$(MsbuildThisFileDirectory)..\..\Directory.Build.props" /> |
5 | <Import Project="Wix.Build.props" Condition=" '$(MSBuildProjectExtension)'=='.wixproj' " /> | 5 | <Import Project="Directory.csproj.props" Condition=" '$(MSBuildProjectExtension)'=='.csproj' " /> |
6 | <Import Project="Directory.wixproj.props" Condition=" '$(MSBuildProjectExtension)'=='.wixproj' " /> | ||
6 | </Project> | 7 | </Project> |
diff --git a/src/ext/Bal/test/examples/Directory.Build.targets b/src/ext/Bal/test/examples/Directory.Build.targets index 35946585..b27a1a41 100644 --- a/src/ext/Bal/test/examples/Directory.Build.targets +++ b/src/ext/Bal/test/examples/Directory.Build.targets | |||
@@ -2,5 +2,6 @@ | |||
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 | <Project> | 3 | <Project> |
4 | <Import Project="$(MsbuildThisFileDirectory)..\..\..\..\Directory.Build.targets" /> | 4 | <Import Project="$(MsbuildThisFileDirectory)..\..\..\..\Directory.Build.targets" /> |
5 | <Import Project="Wix.Build.targets" Condition=" '$(MSBuildProjectExtension)'=='.wixproj' " /> | 5 | <Import Project="Directory.wixproj.targets" Condition=" '$(MSBuildProjectExtension)'=='.wixproj' " /> |
6 | <Import Project="DncBA.targets" Condition=" '$(IsDncBA)'=='true' " /> | ||
6 | </Project> | 7 | </Project> |
diff --git a/src/ext/Bal/test/examples/Directory.csproj.props b/src/ext/Bal/test/examples/Directory.csproj.props new file mode 100644 index 00000000..e314ca20 --- /dev/null +++ b/src/ext/Bal/test/examples/Directory.csproj.props | |||
@@ -0,0 +1,5 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
3 | <Project> | ||
4 | <Import Project="$(MsbuildThisFileDirectory)..\..\WixToolset.Dnc.HostGenerator\build\WixToolset.Dnc.HostGenerator.props" /> | ||
5 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/Wix.Build.props b/src/ext/Bal/test/examples/Directory.wixproj.props index 78ad462f..78ad462f 100644 --- a/src/ext/Bal/test/examples/Wix.Build.props +++ b/src/ext/Bal/test/examples/Directory.wixproj.props | |||
diff --git a/src/ext/Bal/test/examples/Wix.Build.targets b/src/ext/Bal/test/examples/Directory.wixproj.targets index 7e6fe9f2..7e6fe9f2 100644 --- a/src/ext/Bal/test/examples/Wix.Build.targets +++ b/src/ext/Bal/test/examples/Directory.wixproj.targets | |||
diff --git a/src/ext/Bal/test/examples/DncBA.targets b/src/ext/Bal/test/examples/DncBA.targets new file mode 100644 index 00000000..2b8c1428 --- /dev/null +++ b/src/ext/Bal/test/examples/DncBA.targets | |||
@@ -0,0 +1,19 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | ||
3 | <Project> | ||
4 | <Import Project="$(MsbuildThisFileDirectory)..\..\WixToolset.Dnc.HostGenerator\build\WixToolset.Dnc.HostGenerator.targets" /> | ||
5 | |||
6 | <PropertyGroup> | ||
7 | <ILLinkTreatWarningsAsErrors>false</ILLinkTreatWarningsAsErrors> | ||
8 | </PropertyGroup> | ||
9 | |||
10 | <ItemGroup> | ||
11 | <ProjectReference Include="$(MsbuildThisFileDirectory)..\..\WixToolset.Dnc.HostGenerator\WixToolset.Dnc.HostGenerator.csproj" | ||
12 | OutputItemType="Analyzer" | ||
13 | ReferenceOutputAssembly="false" /> | ||
14 | </ItemGroup> | ||
15 | |||
16 | <ItemGroup> | ||
17 | <PackageReference Include="WixToolset.Mba.Core" /> | ||
18 | </ItemGroup> | ||
19 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj b/src/ext/Bal/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj index 8069df45..9b9f2bf6 100644 --- a/src/ext/Bal/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj +++ b/src/ext/Bal/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj | |||
@@ -3,15 +3,7 @@ | |||
3 | <PropertyGroup> | 3 | <PropertyGroup> |
4 | <TargetFramework>netcoreapp3.1</TargetFramework> | 4 | <TargetFramework>netcoreapp3.1</TargetFramework> |
5 | <RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers> | 5 | <RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers> |
6 | <EnableDynamicLoading>true</EnableDynamicLoading> | 6 | <IsDncBA>true</IsDncBA> |
7 | <Description>Earliest .NET Core MBA</Description> | 7 | <Description>Earliest .NET Core MBA</Description> |
8 | </PropertyGroup> | 8 | </PropertyGroup> |
9 | |||
10 | <ItemGroup> | ||
11 | <TrimmerRootAssembly Include="System.Runtime.Loader" /> | ||
12 | </ItemGroup> | ||
13 | |||
14 | <ItemGroup> | ||
15 | <PackageReference Include="WixToolset.Mba.Core" /> | ||
16 | </ItemGroup> | ||
17 | </Project> | 9 | </Project> |
diff --git a/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj b/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj index aad56a3e..a884fa07 100644 --- a/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj +++ b/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj | |||
@@ -3,18 +3,7 @@ | |||
3 | <PropertyGroup> | 3 | <PropertyGroup> |
4 | <TargetFramework>net5.0</TargetFramework> | 4 | <TargetFramework>net5.0</TargetFramework> |
5 | <RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers> | 5 | <RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers> |
6 | <EnableDynamicLoading>true</EnableDynamicLoading> | 6 | <IsDncBA>true</IsDncBA> |
7 | <Description>Latest .NET Core MBA</Description> | 7 | <Description>Latest .NET Core MBA</Description> |
8 | </PropertyGroup> | 8 | </PropertyGroup> |
9 | |||
10 | <ItemGroup> | ||
11 | <TrimmerRootAssembly Include="System.Diagnostics.Tools" /> | ||
12 | <TrimmerRootAssembly Include="System.Runtime" /> | ||
13 | <TrimmerRootAssembly Include="System.Runtime.InteropServices" /> | ||
14 | <TrimmerRootAssembly Include="System.Runtime.Loader" /> | ||
15 | </ItemGroup> | ||
16 | |||
17 | <ItemGroup> | ||
18 | <PackageReference Include="WixToolset.Mba.Core" /> | ||
19 | </ItemGroup> | ||
20 | </Project> | 9 | </Project> |
diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj b/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj index 3d63e7b9..3186148b 100644 --- a/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj +++ b/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj | |||
@@ -3,22 +3,8 @@ | |||
3 | <PropertyGroup> | 3 | <PropertyGroup> |
4 | <TargetFramework>net5.0-windows</TargetFramework> | 4 | <TargetFramework>net5.0-windows</TargetFramework> |
5 | <RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers> | 5 | <RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers> |
6 | <EnableDynamicLoading>true</EnableDynamicLoading> | 6 | <IsDncBA>true</IsDncBA> |
7 | <Description>WPF .NET Core MBA</Description> | 7 | <Description>WPF .NET Core MBA</Description> |
8 | <UseWPF>true</UseWPF> | 8 | <UseWPF>true</UseWPF> |
9 | </PropertyGroup> | 9 | </PropertyGroup> |
10 | |||
11 | <ItemGroup> | ||
12 | <PackageReference Include="WixToolset.Mba.Core" /> | ||
13 | </ItemGroup> | ||
14 | |||
15 | <Target Name="GitVersion"> | ||
16 | <PropertyGroup> | ||
17 | <GitBaseVersionMajor>42</GitBaseVersionMajor> | ||
18 | <GitBaseVersionMinor>42</GitBaseVersionMinor> | ||
19 | <GitBaseVersionPatch>42</GitBaseVersionPatch> | ||
20 | <GitCommits>42</GitCommits> | ||
21 | <GitSha>abc123def456</GitSha> | ||
22 | </PropertyGroup> | ||
23 | </Target> | ||
24 | </Project> | 10 | </Project> |
diff --git a/src/ext/Bal/test/examples/examples.proj b/src/ext/Bal/test/examples/examples.proj index 5722cfcb..a16af2a4 100644 --- a/src/ext/Bal/test/examples/examples.proj +++ b/src/ext/Bal/test/examples/examples.proj | |||
@@ -17,14 +17,15 @@ | |||
17 | <ItemGroup> | 17 | <ItemGroup> |
18 | <CoreMBAProject Include="$(EarliestCoreMBAProjectPath)"> | 18 | <CoreMBAProject Include="$(EarliestCoreMBAProjectPath)"> |
19 | <PublishPath>$(MBAPublishPath)Example.EarliestCoreMBA</PublishPath> | 19 | <PublishPath>$(MBAPublishPath)Example.EarliestCoreMBA</PublishPath> |
20 | <TrimMode>CopyUsed</TrimMode> | ||
20 | </CoreMBAProject> | 21 | </CoreMBAProject> |
21 | <CoreMBAProject Include="$(LatestCoreMBAProjectPath)"> | 22 | <CoreMBAProject Include="$(LatestCoreMBAProjectPath)"> |
22 | <PublishPath>$(MBAPublishPath)Example.LatestCoreMBA</PublishPath> | 23 | <PublishPath>$(MBAPublishPath)Example.LatestCoreMBA</PublishPath> |
24 | <TrimMode>Link</TrimMode> | ||
23 | </CoreMBAProject> | 25 | </CoreMBAProject> |
24 | <CoreMBAProject Include="$(WPFCoreMBAProjectPath)"> | 26 | <CoreMBAProject Include="$(WPFCoreMBAProjectPath)"> |
25 | <PublishPath>$(MBAPublishPath)Example.WPFCoreMBA</PublishPath> | 27 | <PublishPath>$(MBAPublishPath)Example.WPFCoreMBA</PublishPath> |
26 | <SkipSCD>true</SkipSCD> | 28 | <SkipSCD>true</SkipSCD> |
27 | <SkipTrimmedSCD>true</SkipTrimmedSCD> | ||
28 | </CoreMBAProject> | 29 | </CoreMBAProject> |
29 | 30 | ||
30 | <FullMBAProject Include="$(FullFramework2MBAProjectPath)" /> | 31 | <FullMBAProject Include="$(FullFramework2MBAProjectPath)" /> |
@@ -38,8 +39,8 @@ | |||
38 | Condition="'%(CoreMBAProject.SkipFDD)'==''" /> | 39 | Condition="'%(CoreMBAProject.SkipFDD)'==''" /> |
39 | <Exec Command='dotnet publish -o "%(CoreMBAProject.PublishPath)\scd" -r win-x86 -c $(Configuration) --self-contained true "%(CoreMBAProject.Identity)"' | 40 | <Exec Command='dotnet publish -o "%(CoreMBAProject.PublishPath)\scd" -r win-x86 -c $(Configuration) --self-contained true "%(CoreMBAProject.Identity)"' |
40 | Condition="'%(CoreMBAProject.SkipSCD)'==''" /> | 41 | Condition="'%(CoreMBAProject.SkipSCD)'==''" /> |
41 | <Exec Command='dotnet publish -o "%(CoreMBAProject.PublishPath)\trimmedscd" -r win-x86 -c $(Configuration) --self-contained true -p:PublishTrimmed=true "%(CoreMBAProject.Identity)"' | 42 | <Exec Command='dotnet publish -o "%(CoreMBAProject.PublishPath)\trimmedscd" -r win-x86 -c $(Configuration) --self-contained true -p:PublishTrimmed=true -p:TrimMode=%(CoreMBAProject.TrimMode) "%(CoreMBAProject.Identity)"' |
42 | Condition="'%(CoreMBAProject.SkipTrimmedSCD)'==''" /> | 43 | Condition="'%(CoreMBAProject.TrimMode)'!=''" /> |
43 | </Target> | 44 | </Target> |
44 | 45 | ||
45 | <Target Name="Build" DependsOnTargets="PublishCoreExamples"> | 46 | <Target Name="Build" DependsOnTargets="PublishCoreExamples"> |
diff --git a/src/ext/Bal/wixext/WixToolset.Bal.wixext.nuspec b/src/ext/Bal/wixext/WixToolset.Bal.wixext.nuspec index 4abfa98c..cdbb001c 100644 --- a/src/ext/Bal/wixext/WixToolset.Bal.wixext.nuspec +++ b/src/ext/Bal/wixext/WixToolset.Bal.wixext.nuspec | |||
@@ -7,7 +7,7 @@ | |||
7 | <owners>$authors$</owners> | 7 | <owners>$authors$</owners> |
8 | <icon>wix-white-bg.png</icon> | 8 | <icon>wix-white-bg.png</icon> |
9 | <license type="expression">MS-RL</license> | 9 | <license type="expression">MS-RL</license> |
10 | <projectUrl>https://github.com/wixtoolset/Bal.wixext</projectUrl> | 10 | <projectUrl>$projectUrl$</projectUrl> |
11 | <requireLicenseAcceptance>false</requireLicenseAcceptance> | 11 | <requireLicenseAcceptance>false</requireLicenseAcceptance> |
12 | <title>$title$</title> | 12 | <title>$title$</title> |
13 | <description>$description$</description> | 13 | <description>$description$</description> |
diff --git a/src/ext/Bal/wixlib/BalExtension_platform.wxi b/src/ext/Bal/wixlib/BalExtension_platform.wxi index e1d846ce..b2750eee 100644 --- a/src/ext/Bal/wixlib/BalExtension_platform.wxi +++ b/src/ext/Bal/wixlib/BalExtension_platform.wxi | |||
@@ -8,7 +8,6 @@ | |||
8 | <BootstrapperApplication Id="WixDotNetCoreBootstrapperApplicationHost$(var.Suffix)"> | 8 | <BootstrapperApplication Id="WixDotNetCoreBootstrapperApplicationHost$(var.Suffix)"> |
9 | <BootstrapperApplicationDll Id="WixDotNetCoreBootstrapperApplicationHost" SourceFile="!(bindpath.$(var.platform))\dnchost.dll" /> | 9 | <BootstrapperApplicationDll Id="WixDotNetCoreBootstrapperApplicationHost" SourceFile="!(bindpath.$(var.platform))\dnchost.dll" /> |
10 | <Payload SourceFile="!(bindpath.$(var.platform))\wixstdba.dll" Name="dncpreq.dll" /> | 10 | <Payload SourceFile="!(bindpath.$(var.platform))\wixstdba.dll" Name="dncpreq.dll" /> |
11 | <PayloadGroupRef Id="WixDotNetCoreBootstrapperApplicationHostManagedPayloads" /> | ||
12 | </BootstrapperApplication> | 11 | </BootstrapperApplication> |
13 | </Fragment> | 12 | </Fragment> |
14 | 13 | ||
diff --git a/src/ext/Bal/wixlib/Dnc.wxs b/src/ext/Bal/wixlib/Dnc.wxs index d777c473..242bb30e 100644 --- a/src/ext/Bal/wixlib/Dnc.wxs +++ b/src/ext/Bal/wixlib/Dnc.wxs | |||
@@ -6,11 +6,6 @@ | |||
6 | Dnc.wxs - .NET Core BA resources. | 6 | Dnc.wxs - .NET Core BA resources. |
7 | --> | 7 | --> |
8 | <Fragment> | 8 | <Fragment> |
9 | <PayloadGroup Id="WixDotNetCoreBootstrapperApplicationHostManagedPayloads"> | ||
10 | <Payload SourceFile="WixToolset.Dnc.Host.dll" /> | ||
11 | </PayloadGroup> | ||
12 | </Fragment> | ||
13 | <Fragment> | ||
14 | <PayloadGroup Id="DncPreqStandardPayloads"> | 9 | <PayloadGroup Id="DncPreqStandardPayloads"> |
15 | <Payload Name="mbapreq.thm" SourceFile="!(wix.DncPreqbaThemeXml=SourceDir\dncpreq.thm)" /> | 10 | <Payload Name="mbapreq.thm" SourceFile="!(wix.DncPreqbaThemeXml=SourceDir\dncpreq.thm)" /> |
16 | <Payload Name="mbapreq.png" SourceFile="!(wix.DncPreqbaLogo=SourceDir\mbapreq.png)" /> | 11 | <Payload Name="mbapreq.png" SourceFile="!(wix.DncPreqbaLogo=SourceDir\mbapreq.png)" /> |
diff --git a/src/internal/SetBuildNumber/Directory.Packages.props.pp b/src/internal/SetBuildNumber/Directory.Packages.props.pp index 6737cc38..675907e5 100644 --- a/src/internal/SetBuildNumber/Directory.Packages.props.pp +++ b/src/internal/SetBuildNumber/Directory.Packages.props.pp | |||
@@ -21,6 +21,7 @@ | |||
21 | <PackageVersion Include="WixToolset.Extensibility" Version="{packageversion}" /> | 21 | <PackageVersion Include="WixToolset.Extensibility" Version="{packageversion}" /> |
22 | 22 | ||
23 | <PackageVersion Include="WixToolset.Burn" Version="{packageversion}" /> | 23 | <PackageVersion Include="WixToolset.Burn" Version="{packageversion}" /> |
24 | <PackageVersion Include="WixToolset.Dnc.HostGenerator" Version="{packageversion}" /> | ||
24 | 25 | ||
25 | <PackageVersion Include="WixToolset.Core" Version="{packageversion}" /> | 26 | <PackageVersion Include="WixToolset.Core" Version="{packageversion}" /> |
26 | <PackageVersion Include="WixToolset.Core.Burn" Version="{packageversion}" /> | 27 | <PackageVersion Include="WixToolset.Core.Burn" Version="{packageversion}" /> |
@@ -45,6 +46,10 @@ | |||
45 | <PackageVersion Include="System.Text.Encoding.CodePages" Version="4.6.0" /> | 46 | <PackageVersion Include="System.Text.Encoding.CodePages" Version="4.6.0" /> |
46 | 47 | ||
47 | <PackageVersion Include="Microsoft.AspNetCore.Owin" Version="3.1.13" /> | 48 | <PackageVersion Include="Microsoft.AspNetCore.Owin" Version="3.1.13" /> |
49 | <PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3" /> | ||
50 | <PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" /> | ||
51 | <PackageVersion Include="Microsoft.CodeAnalysis.CSharp.SourceGenerators.Testing.XUnit" Version="1.1.1" /> | ||
52 | <PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.8.0" /> | ||
48 | <PackageVersion Include="Microsoft.VisualStudio.Setup.Configuration.Native" Version="1.14.114" /> | 53 | <PackageVersion Include="Microsoft.VisualStudio.Setup.Configuration.Native" Version="1.14.114" /> |
49 | <PackageVersion Include="Microsoft.Win32.Registry" Version="4.7.0" /> | 54 | <PackageVersion Include="Microsoft.Win32.Registry" Version="4.7.0" /> |
50 | 55 | ||
diff --git a/src/test/burn/TestBA/TestBA.csproj b/src/test/burn/TestBA/TestBA.csproj index 183ea02d..7d51f4aa 100644 --- a/src/test/burn/TestBA/TestBA.csproj +++ b/src/test/burn/TestBA/TestBA.csproj | |||
@@ -21,4 +21,8 @@ | |||
21 | <ItemGroup> | 21 | <ItemGroup> |
22 | <PackageReference Include="WixToolset.Mba.Core" /> | 22 | <PackageReference Include="WixToolset.Mba.Core" /> |
23 | </ItemGroup> | 23 | </ItemGroup> |
24 | |||
25 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'!='.NETFramework' "> | ||
26 | <PackageReference Include="WixToolset.Dnc.HostGenerator" /> | ||
27 | </ItemGroup> | ||
24 | </Project> | 28 | </Project> |
diff --git a/src/test/burn/TestBA/TestBA_x64.csproj b/src/test/burn/TestBA/TestBA_x64.csproj index 8e2bf513..cb9db1c4 100644 --- a/src/test/burn/TestBA/TestBA_x64.csproj +++ b/src/test/burn/TestBA/TestBA_x64.csproj | |||
@@ -21,4 +21,8 @@ | |||
21 | <ItemGroup> | 21 | <ItemGroup> |
22 | <PackageReference Include="WixToolset.Mba.Core" /> | 22 | <PackageReference Include="WixToolset.Mba.Core" /> |
23 | </ItemGroup> | 23 | </ItemGroup> |
24 | |||
25 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'!='.NETFramework' "> | ||
26 | <PackageReference Include="WixToolset.Dnc.HostGenerator" /> | ||
27 | </ItemGroup> | ||
24 | </Project> | 28 | </Project> |
diff --git a/src/test/burn/TestData/TestBA/TestBAWixlib/testbawixlib.wixproj b/src/test/burn/TestData/TestBA/TestBAWixlib/testbawixlib.wixproj index fa153974..fdce5ecd 100644 --- a/src/test/burn/TestData/TestBA/TestBAWixlib/testbawixlib.wixproj +++ b/src/test/burn/TestData/TestBA/TestBAWixlib/testbawixlib.wixproj | |||
@@ -7,7 +7,7 @@ | |||
7 | </PropertyGroup> | 7 | </PropertyGroup> |
8 | <ItemGroup> | 8 | <ItemGroup> |
9 | <BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net35\win-x86" BindName="net2x86" /> | 9 | <BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net35\win-x86" BindName="net2x86" /> |
10 | <BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net45\win-x86" BindName="net4x86" /> | 10 | <BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net472\win-x86" BindName="net4x86" /> |
11 | <BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net5.0-windows\win-x86" BindName="dnc5x86" /> | 11 | <BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net5.0-windows\win-x86" BindName="dnc5x86" /> |
12 | </ItemGroup> | 12 | </ItemGroup> |
13 | <ItemGroup> | 13 | <ItemGroup> |
diff --git a/src/test/burn/TestData/TestBA/TestBAWixlib_x64/testbawixlib_x64.wixproj b/src/test/burn/TestData/TestBA/TestBAWixlib_x64/testbawixlib_x64.wixproj index 9bba3d8f..e63eb74c 100644 --- a/src/test/burn/TestData/TestBA/TestBAWixlib_x64/testbawixlib_x64.wixproj +++ b/src/test/burn/TestData/TestBA/TestBAWixlib_x64/testbawixlib_x64.wixproj | |||
@@ -8,7 +8,7 @@ | |||
8 | </PropertyGroup> | 8 | </PropertyGroup> |
9 | <ItemGroup> | 9 | <ItemGroup> |
10 | <BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net35\win-x64" BindName="net2x64" /> | 10 | <BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net35\win-x64" BindName="net2x64" /> |
11 | <BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net45\win-x64" BindName="net4x64" /> | 11 | <BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net472\win-x64" BindName="net4x64" /> |
12 | <BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net5.0-windows\win-x64" BindName="dnc5x64" /> | 12 | <BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net5.0-windows\win-x64" BindName="dnc5x64" /> |
13 | </ItemGroup> | 13 | </ItemGroup> |
14 | <ItemGroup> | 14 | <ItemGroup> |
diff --git a/src/test/burn/WixToolset.WixBA/WixToolset.WixBA.csproj b/src/test/burn/WixToolset.WixBA/WixToolset.WixBA.csproj index 2a2a0073..b872457c 100644 --- a/src/test/burn/WixToolset.WixBA/WixToolset.WixBA.csproj +++ b/src/test/burn/WixToolset.WixBA/WixToolset.WixBA.csproj | |||
@@ -2,7 +2,7 @@ | |||
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 | <Project Sdk="Microsoft.NET.Sdk"> | 3 | <Project Sdk="Microsoft.NET.Sdk"> |
4 | <PropertyGroup> | 4 | <PropertyGroup> |
5 | <TargetFrameworks>net45;net5.0-windows</TargetFrameworks> | 5 | <TargetFrameworks>net472;net5.0-windows</TargetFrameworks> |
6 | <AssemblyName>WixToolset.WixBA</AssemblyName> | 6 | <AssemblyName>WixToolset.WixBA</AssemblyName> |
7 | <RootNamespace>WixToolset.WixBA</RootNamespace> | 7 | <RootNamespace>WixToolset.WixBA</RootNamespace> |
8 | <DebugType>embedded</DebugType> | 8 | <DebugType>embedded</DebugType> |
@@ -19,14 +19,14 @@ | |||
19 | <!-- https://stackoverflow.com/questions/58844785/how-to-reference-system-windows-forms-in-net-core-3-0-for-wpf-apps --> | 19 | <!-- https://stackoverflow.com/questions/58844785/how-to-reference-system-windows-forms-in-net-core-3-0-for-wpf-apps --> |
20 | <UseWindowsForms>true</UseWindowsForms> | 20 | <UseWindowsForms>true</UseWindowsForms> |
21 | </PropertyGroup> | 21 | </PropertyGroup> |
22 | <ItemGroup Condition="'$(TargetFramework)'=='net45'"> | 22 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'=='.NETFramework' "> |
23 | <Content Include="WixBA.BootstrapperCore.config" CopyToOutputDirectory="PreserveNewest" /> | 23 | <Content Include="WixBA.BootstrapperCore.config" CopyToOutputDirectory="PreserveNewest" /> |
24 | </ItemGroup> | 24 | </ItemGroup> |
25 | <ItemGroup> | 25 | <ItemGroup> |
26 | <Resource Include="Resources\logo-white-hollow.png" /> | 26 | <Resource Include="Resources\logo-white-hollow.png" /> |
27 | <Resource Include="Resources\logo-black-hollow.png" /> | 27 | <Resource Include="Resources\logo-black-hollow.png" /> |
28 | </ItemGroup> | 28 | </ItemGroup> |
29 | <ItemGroup Condition="'$(TargetFramework)'=='net45'"> | 29 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'=='.NETFramework' "> |
30 | <Reference Include="PresentationCore" /> | 30 | <Reference Include="PresentationCore" /> |
31 | <Reference Include="PresentationFramework" /> | 31 | <Reference Include="PresentationFramework" /> |
32 | <Reference Include="System.Windows.Forms" /> | 32 | <Reference Include="System.Windows.Forms" /> |
@@ -37,4 +37,8 @@ | |||
37 | <ItemGroup> | 37 | <ItemGroup> |
38 | <PackageReference Include="WixToolset.Mba.Core" /> | 38 | <PackageReference Include="WixToolset.Mba.Core" /> |
39 | </ItemGroup> | 39 | </ItemGroup> |
40 | |||
41 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'!='.NETFramework' "> | ||
42 | <PackageReference Include="WixToolset.Dnc.HostGenerator" /> | ||
43 | </ItemGroup> | ||
40 | </Project> \ No newline at end of file | 44 | </Project> \ No newline at end of file |
diff --git a/src/test/burn/WixToolset.WixBA/WixToolset.WixBA_x64.csproj b/src/test/burn/WixToolset.WixBA/WixToolset.WixBA_x64.csproj index bc1aa7bf..672f7a62 100644 --- a/src/test/burn/WixToolset.WixBA/WixToolset.WixBA_x64.csproj +++ b/src/test/burn/WixToolset.WixBA/WixToolset.WixBA_x64.csproj | |||
@@ -2,7 +2,7 @@ | |||
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 | <Project Sdk="Microsoft.NET.Sdk"> | 3 | <Project Sdk="Microsoft.NET.Sdk"> |
4 | <PropertyGroup> | 4 | <PropertyGroup> |
5 | <TargetFrameworks>net45;net5.0-windows</TargetFrameworks> | 5 | <TargetFrameworks>net472;net5.0-windows</TargetFrameworks> |
6 | <AssemblyName>WixToolset.WixBA</AssemblyName> | 6 | <AssemblyName>WixToolset.WixBA</AssemblyName> |
7 | <RootNamespace>WixToolset.WixBA</RootNamespace> | 7 | <RootNamespace>WixToolset.WixBA</RootNamespace> |
8 | <DebugType>embedded</DebugType> | 8 | <DebugType>embedded</DebugType> |
@@ -19,14 +19,14 @@ | |||
19 | <!-- https://stackoverflow.com/questions/58844785/how-to-reference-system-windows-forms-in-net-core-3-0-for-wpf-apps --> | 19 | <!-- https://stackoverflow.com/questions/58844785/how-to-reference-system-windows-forms-in-net-core-3-0-for-wpf-apps --> |
20 | <UseWindowsForms>true</UseWindowsForms> | 20 | <UseWindowsForms>true</UseWindowsForms> |
21 | </PropertyGroup> | 21 | </PropertyGroup> |
22 | <ItemGroup Condition="'$(TargetFramework)'=='net45'"> | 22 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'=='.NETFramework' "> |
23 | <Content Include="WixBA.BootstrapperCore.config" CopyToOutputDirectory="PreserveNewest" /> | 23 | <Content Include="WixBA.BootstrapperCore.config" CopyToOutputDirectory="PreserveNewest" /> |
24 | </ItemGroup> | 24 | </ItemGroup> |
25 | <ItemGroup> | 25 | <ItemGroup> |
26 | <Resource Include="Resources\logo-white-hollow.png" /> | 26 | <Resource Include="Resources\logo-white-hollow.png" /> |
27 | <Resource Include="Resources\logo-black-hollow.png" /> | 27 | <Resource Include="Resources\logo-black-hollow.png" /> |
28 | </ItemGroup> | 28 | </ItemGroup> |
29 | <ItemGroup Condition="'$(TargetFramework)'=='net45'"> | 29 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'=='.NETFramework' "> |
30 | <Reference Include="PresentationCore" /> | 30 | <Reference Include="PresentationCore" /> |
31 | <Reference Include="PresentationFramework" /> | 31 | <Reference Include="PresentationFramework" /> |
32 | <Reference Include="System.Windows.Forms" /> | 32 | <Reference Include="System.Windows.Forms" /> |
@@ -37,4 +37,8 @@ | |||
37 | <ItemGroup> | 37 | <ItemGroup> |
38 | <PackageReference Include="WixToolset.Mba.Core" /> | 38 | <PackageReference Include="WixToolset.Mba.Core" /> |
39 | </ItemGroup> | 39 | </ItemGroup> |
40 | |||
41 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'!='.NETFramework' "> | ||
42 | <PackageReference Include="WixToolset.Dnc.HostGenerator" /> | ||
43 | </ItemGroup> | ||
40 | </Project> \ No newline at end of file | 44 | </Project> \ No newline at end of file |
diff --git a/src/testresultfilelist.txt b/src/testresultfilelist.txt index 97c698e6..20531e2d 100644 --- a/src/testresultfilelist.txt +++ b/src/testresultfilelist.txt | |||
@@ -12,6 +12,7 @@ build/logs/TestResults/WixToolsetTest.Core.trx | |||
12 | build/logs/TestResults/WixToolsetTest.Core.Burn.trx | 12 | build/logs/TestResults/WixToolsetTest.Core.Burn.trx |
13 | build/logs/TestResults/WixToolsetTest.Core.Native.trx | 13 | build/logs/TestResults/WixToolsetTest.Core.Native.trx |
14 | build/logs/TestResults/WixToolsetTest.CoreIntegration.trx | 14 | build/logs/TestResults/WixToolsetTest.CoreIntegration.trx |
15 | build/logs/TestResults/WixToolsetTest.Dnc.HostGenerator.trx | ||
15 | build/logs/TestResults/WixToolsetTest.Heat.trx | 16 | build/logs/TestResults/WixToolsetTest.Heat.trx |
16 | build/logs/TestResults/WixToolsetTest.Mba.Core.trx | 17 | build/logs/TestResults/WixToolsetTest.Mba.Core.trx |
17 | build/logs/TestResults/WixToolsetTest.Sdk.trx | 18 | build/logs/TestResults/WixToolsetTest.Sdk.trx |
diff --git a/src/wix/WixToolset.Sdk/WixToolset.Sdk.csproj b/src/wix/WixToolset.Sdk/WixToolset.Sdk.csproj index bab6e9b7..b6751ed9 100644 --- a/src/wix/WixToolset.Sdk/WixToolset.Sdk.csproj +++ b/src/wix/WixToolset.Sdk/WixToolset.Sdk.csproj | |||
@@ -4,12 +4,10 @@ | |||
4 | <Project Sdk="Microsoft.NET.Sdk"> | 4 | <Project Sdk="Microsoft.NET.Sdk"> |
5 | <PropertyGroup> | 5 | <PropertyGroup> |
6 | <TargetFramework>netcoreapp3.1</TargetFramework> | 6 | <TargetFramework>netcoreapp3.1</TargetFramework> |
7 | <IncludeBuildOutput>false</IncludeBuildOutput> | ||
8 | <Description>WiX Toolset MSBuild integration</Description> | 7 | <Description>WiX Toolset MSBuild integration</Description> |
9 | <PublishDir>$(OutputPath)publish\WixToolset.Sdk\</PublishDir> | 8 | <PublishDir>$(OutputPath)publish\WixToolset.Sdk\</PublishDir> |
10 | <NuspecFile>$(MSBuildThisFileName).nuspec</NuspecFile> | 9 | <NuspecFile>$(MSBuildThisFileName).nuspec</NuspecFile> |
11 | <NuspecBasePath>$(PublishDir)</NuspecBasePath> | 10 | <NuspecBasePath>$(PublishDir)</NuspecBasePath> |
12 | <NuspecProperties>Id=$(MSBuildThisFileName);Authors=$(Authors);Copyright=$(Copyright);Description=$(Description)</NuspecProperties> | ||
13 | </PropertyGroup> | 11 | </PropertyGroup> |
14 | 12 | ||
15 | <ItemGroup> | 13 | <ItemGroup> |