diff options
author | Rob Mensching <rob@firegiant.com> | 2024-01-11 18:26:20 -0800 |
---|---|---|
committer | Rob Mensching <rob@firegiant.com> | 2024-03-06 18:03:38 -0800 |
commit | 0d3d54992104288e9ee0c834d0b96e8502fd2d42 (patch) | |
tree | 9efa49c4983cd2ba1becab64bd1f2faccac88acf /src/test/burn/WixToolset.WixBA | |
parent | 2824298d9dd817a47527c920363556b54ead5d5d (diff) | |
download | wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.tar.gz wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.tar.bz2 wix-0d3d54992104288e9ee0c834d0b96e8502fd2d42.zip |
Move the BootstrapperApplication out of proc
Diffstat (limited to 'src/test/burn/WixToolset.WixBA')
-rw-r--r-- | src/test/burn/WixToolset.WixBA/InstallationViewModel.cs | 11 | ||||
-rw-r--r-- | src/test/burn/WixToolset.WixBA/Program.cs | 18 | ||||
-rw-r--r-- | src/test/burn/WixToolset.WixBA/UpdateViewModel.cs | 12 | ||||
-rw-r--r-- | src/test/burn/WixToolset.WixBA/WixBA.cs | 19 | ||||
-rw-r--r-- | src/test/burn/WixToolset.WixBA/WixBAFactory.cs | 17 | ||||
-rw-r--r-- | src/test/burn/WixToolset.WixBA/WixToolset.WixBA.csproj | 12 | ||||
-rw-r--r-- | src/test/burn/WixToolset.WixBA/WixToolset.WixBA_x64.csproj | 12 |
7 files changed, 52 insertions, 49 deletions
diff --git a/src/test/burn/WixToolset.WixBA/InstallationViewModel.cs b/src/test/burn/WixToolset.WixBA/InstallationViewModel.cs index 3a71779a..e67783bc 100644 --- a/src/test/burn/WixToolset.WixBA/InstallationViewModel.cs +++ b/src/test/burn/WixToolset.WixBA/InstallationViewModel.cs | |||
@@ -97,7 +97,6 @@ namespace WixToolset.WixBA | |||
97 | WixBA.Model.Bootstrapper.ExecutePackageComplete += this.ExecutePackageComplete; | 97 | WixBA.Model.Bootstrapper.ExecutePackageComplete += this.ExecutePackageComplete; |
98 | WixBA.Model.Bootstrapper.Error += this.ExecuteError; | 98 | WixBA.Model.Bootstrapper.Error += this.ExecuteError; |
99 | WixBA.Model.Bootstrapper.ApplyComplete += this.ApplyComplete; | 99 | WixBA.Model.Bootstrapper.ApplyComplete += this.ApplyComplete; |
100 | WixBA.Model.Bootstrapper.SetUpdateComplete += this.SetUpdateComplete; | ||
101 | } | 100 | } |
102 | 101 | ||
103 | void RootPropertyChanged(object sender, PropertyChangedEventArgs e) | 102 | void RootPropertyChanged(object sender, PropertyChangedEventArgs e) |
@@ -430,15 +429,7 @@ namespace WixToolset.WixBA | |||
430 | 429 | ||
431 | if (!WixBA.Model.BAManifest.Bundle.Packages.ContainsKey(e.ProductCode)) | 430 | if (!WixBA.Model.BAManifest.Bundle.Packages.ContainsKey(e.ProductCode)) |
432 | { | 431 | { |
433 | WixBA.Model.BAManifest.Bundle.AddRelatedBundleAsPackage(e); | 432 | WixBA.Model.BAManifest.Bundle.AddRelatedBundleAsPackage(e.ProductCode, e.RelationType, e.PerMachine, e.Version); |
434 | } | ||
435 | } | ||
436 | |||
437 | private void SetUpdateComplete(object sender, SetUpdateCompleteEventArgs e) | ||
438 | { | ||
439 | if (!String.IsNullOrEmpty(e.NewPackageId) && !WixBA.Model.BAManifest.Bundle.Packages.ContainsKey(e.NewPackageId)) | ||
440 | { | ||
441 | WixBA.Model.BAManifest.Bundle.AddUpdateBundleAsPackage(e); | ||
442 | } | 433 | } |
443 | } | 434 | } |
444 | 435 | ||
diff --git a/src/test/burn/WixToolset.WixBA/Program.cs b/src/test/burn/WixToolset.WixBA/Program.cs new file mode 100644 index 00000000..670d8313 --- /dev/null +++ b/src/test/burn/WixToolset.WixBA/Program.cs | |||
@@ -0,0 +1,18 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | namespace WixToolset.WixBA | ||
4 | { | ||
5 | using WixToolset.Mba.Core; | ||
6 | |||
7 | internal class Program | ||
8 | { | ||
9 | private static int Main() | ||
10 | { | ||
11 | var application = new WixBA(); | ||
12 | |||
13 | ManagedBootstrapperApplication.Run(application); | ||
14 | |||
15 | return 0; | ||
16 | } | ||
17 | } | ||
18 | } | ||
diff --git a/src/test/burn/WixToolset.WixBA/UpdateViewModel.cs b/src/test/burn/WixToolset.WixBA/UpdateViewModel.cs index dc98c858..2bb92d51 100644 --- a/src/test/burn/WixToolset.WixBA/UpdateViewModel.cs +++ b/src/test/burn/WixToolset.WixBA/UpdateViewModel.cs | |||
@@ -164,7 +164,7 @@ namespace WixToolset.WixBA | |||
164 | e.Skip = false; | 164 | e.Skip = false; |
165 | } | 165 | } |
166 | } | 166 | } |
167 | 167 | ||
168 | private void DetectUpdate(object sender, DetectUpdateEventArgs e) | 168 | private void DetectUpdate(object sender, DetectUpdateEventArgs e) |
169 | { | 169 | { |
170 | // The list of updates is sorted in descending version, so the first callback should be the largest update available. | 170 | // The list of updates is sorted in descending version, so the first callback should be the largest update available. |
@@ -174,7 +174,15 @@ namespace WixToolset.WixBA | |||
174 | WixBA.Model.Engine.Log(LogLevel.Verbose, String.Format("Potential update v{0} from '{1}'; current version: v{2}", e.Version, e.UpdateLocation, WixBA.Model.Version)); | 174 | WixBA.Model.Engine.Log(LogLevel.Verbose, String.Format("Potential update v{0} from '{1}'; current version: v{2}", e.Version, e.UpdateLocation, WixBA.Model.Version)); |
175 | if (WixBA.Model.Engine.CompareVersions(e.Version, WixBA.Model.Version) > 0) | 175 | if (WixBA.Model.Engine.CompareVersions(e.Version, WixBA.Model.Version) > 0) |
176 | { | 176 | { |
177 | WixBA.Model.Engine.SetUpdate(null, e.UpdateLocation, e.Size, UpdateHashType.None, null); | 177 | var updatePackageId = Guid.NewGuid().ToString("N"); |
178 | |||
179 | WixBA.Model.Engine.SetUpdate(null, e.UpdateLocation, e.Size, UpdateHashType.None, null, updatePackageId); | ||
180 | |||
181 | if (!WixBA.Model.BAManifest.Bundle.Packages.ContainsKey(updatePackageId)) | ||
182 | { | ||
183 | WixBA.Model.BAManifest.Bundle.AddUpdateBundleAsPackage(updatePackageId); | ||
184 | } | ||
185 | |||
178 | this.UpdateVersion = String.Concat("v", e.Version.ToString()); | 186 | this.UpdateVersion = String.Concat("v", e.Version.ToString()); |
179 | string changesFormat = @"<body style='overflow: auto;'>{0}</body>"; | 187 | string changesFormat = @"<body style='overflow: auto;'>{0}</body>"; |
180 | this.UpdateChanges = String.Format(changesFormat, e.Content); | 188 | this.UpdateChanges = String.Format(changesFormat, e.Content); |
diff --git a/src/test/burn/WixToolset.WixBA/WixBA.cs b/src/test/burn/WixToolset.WixBA/WixBA.cs index 60426ca8..5b7444c4 100644 --- a/src/test/burn/WixToolset.WixBA/WixBA.cs +++ b/src/test/burn/WixToolset.WixBA/WixBA.cs | |||
@@ -18,17 +18,9 @@ namespace WixToolset.WixBA | |||
18 | /// </summary> | 18 | /// </summary> |
19 | public class WixBA : BootstrapperApplication | 19 | public class WixBA : BootstrapperApplication |
20 | { | 20 | { |
21 | public WixBA(IEngine engine, IBootstrapperCommand command) | 21 | internal IBootstrapperApplicationData BAManifest { get; private set; } |
22 | : base(engine) | ||
23 | { | ||
24 | this.Command = command; | ||
25 | |||
26 | this.BAManifest = new BootstrapperApplicationData(); | ||
27 | } | ||
28 | |||
29 | internal IBootstrapperApplicationData BAManifest { get; } | ||
30 | 22 | ||
31 | internal IBootstrapperCommand Command { get; } | 23 | internal IBootstrapperCommand Command { get; private set; } |
32 | 24 | ||
33 | internal IEngine Engine => this.engine; | 25 | internal IEngine Engine => this.engine; |
34 | 26 | ||
@@ -189,6 +181,13 @@ namespace WixToolset.WixBA | |||
189 | this.Engine.Quit(exitCode); | 181 | this.Engine.Quit(exitCode); |
190 | } | 182 | } |
191 | 183 | ||
184 | protected override void OnCreate(CreateEventArgs args) | ||
185 | { | ||
186 | base.OnCreate(args); | ||
187 | this.Command = args.Command; | ||
188 | this.BAManifest = new BootstrapperApplicationData(); | ||
189 | } | ||
190 | |||
192 | private void PostTelemetry() | 191 | private void PostTelemetry() |
193 | { | 192 | { |
194 | string result = String.Concat("0x", WixBA.Model.Result.ToString("x")); | 193 | string result = String.Concat("0x", WixBA.Model.Result.ToString("x")); |
diff --git a/src/test/burn/WixToolset.WixBA/WixBAFactory.cs b/src/test/burn/WixToolset.WixBA/WixBAFactory.cs deleted file mode 100644 index 67fcc4b5..00000000 --- a/src/test/burn/WixToolset.WixBA/WixBAFactory.cs +++ /dev/null | |||
@@ -1,17 +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 | // Identifies the class that derives from IBootstrapperApplicationFactory and is the BAFactory class that gets | ||
4 | // instantiated by the interop layer | ||
5 | [assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(WixToolset.WixBA.WixBAFactory))] | ||
6 | namespace WixToolset.WixBA | ||
7 | { | ||
8 | using WixToolset.Mba.Core; | ||
9 | |||
10 | public class WixBAFactory : BaseBootstrapperApplicationFactory | ||
11 | { | ||
12 | protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand command) | ||
13 | { | ||
14 | return new WixBA(engine, command); | ||
15 | } | ||
16 | } | ||
17 | } | ||
diff --git a/src/test/burn/WixToolset.WixBA/WixToolset.WixBA.csproj b/src/test/burn/WixToolset.WixBA/WixToolset.WixBA.csproj index 9ee714b6..a0b47744 100644 --- a/src/test/burn/WixToolset.WixBA/WixToolset.WixBA.csproj +++ b/src/test/burn/WixToolset.WixBA/WixToolset.WixBA.csproj | |||
@@ -1,8 +1,10 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | 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 | <Project Sdk="Microsoft.NET.Sdk"> | 4 | <Project Sdk="Microsoft.NET.Sdk"> |
4 | <PropertyGroup> | 5 | <PropertyGroup> |
5 | <TargetFrameworks>net472;net6.0-windows</TargetFrameworks> | 6 | <TargetFrameworks>net472;net6.0-windows</TargetFrameworks> |
7 | <OutputType>WinExe</OutputType> | ||
6 | <AssemblyName>WixToolset.WixBA</AssemblyName> | 8 | <AssemblyName>WixToolset.WixBA</AssemblyName> |
7 | <RootNamespace>WixToolset.WixBA</RootNamespace> | 9 | <RootNamespace>WixToolset.WixBA</RootNamespace> |
8 | <DebugType>embedded</DebugType> | 10 | <DebugType>embedded</DebugType> |
@@ -15,17 +17,21 @@ | |||
15 | <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> | 17 | <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
16 | <EnableDynamicLoading>true</EnableDynamicLoading> | 18 | <EnableDynamicLoading>true</EnableDynamicLoading> |
17 | <UseWPF>true</UseWPF> | 19 | <UseWPF>true</UseWPF> |
20 | <SelfContained>false</SelfContained> | ||
18 | <RollForward>Major</RollForward> | 21 | <RollForward>Major</RollForward> |
19 | <!-- https://stackoverflow.com/questions/58844785/how-to-reference-system-windows-forms-in-net-core-3-0-for-wpf-apps --> | 22 | <!-- https://stackoverflow.com/questions/58844785/how-to-reference-system-windows-forms-in-net-core-3-0-for-wpf-apps --> |
20 | <UseWindowsForms>true</UseWindowsForms> | 23 | <UseWindowsForms>true</UseWindowsForms> |
21 | </PropertyGroup> | 24 | </PropertyGroup> |
25 | |||
22 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'=='.NETFramework' "> | 26 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'=='.NETFramework' "> |
23 | <Content Include="WixBA.BootstrapperCore.config" CopyToOutputDirectory="PreserveNewest" /> | 27 | <Content Include="WixBA.BootstrapperCore.config" CopyToOutputDirectory="PreserveNewest" /> |
24 | </ItemGroup> | 28 | </ItemGroup> |
29 | |||
25 | <ItemGroup> | 30 | <ItemGroup> |
26 | <Resource Include="Resources\logo-white-hollow.png" /> | 31 | <Resource Include="Resources\logo-white-hollow.png" /> |
27 | <Resource Include="Resources\logo-black-hollow.png" /> | 32 | <Resource Include="Resources\logo-black-hollow.png" /> |
28 | </ItemGroup> | 33 | </ItemGroup> |
34 | |||
29 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'=='.NETFramework' "> | 35 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'=='.NETFramework' "> |
30 | <Reference Include="PresentationCore" /> | 36 | <Reference Include="PresentationCore" /> |
31 | <Reference Include="PresentationFramework" /> | 37 | <Reference Include="PresentationFramework" /> |
@@ -37,8 +43,4 @@ | |||
37 | <ItemGroup> | 43 | <ItemGroup> |
38 | <PackageReference Include="WixToolset.Mba.Core" /> | 44 | <PackageReference Include="WixToolset.Mba.Core" /> |
39 | </ItemGroup> | 45 | </ItemGroup> |
40 | 46 | </Project> | |
41 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'!='.NETFramework' "> | ||
42 | <PackageReference Include="WixToolset.Dnc.HostGenerator" /> | ||
43 | </ItemGroup> | ||
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 9307c6c9..b17622a6 100644 --- a/src/test/burn/WixToolset.WixBA/WixToolset.WixBA_x64.csproj +++ b/src/test/burn/WixToolset.WixBA/WixToolset.WixBA_x64.csproj | |||
@@ -1,8 +1,10 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | 1 | <?xml version="1.0" encoding="utf-8"?> |
2 | <!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. --> | 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 | <Project Sdk="Microsoft.NET.Sdk"> | 4 | <Project Sdk="Microsoft.NET.Sdk"> |
4 | <PropertyGroup> | 5 | <PropertyGroup> |
5 | <TargetFrameworks>net472;net6.0-windows</TargetFrameworks> | 6 | <TargetFrameworks>net472;net6.0-windows</TargetFrameworks> |
7 | <OutputType>WinExe</OutputType> | ||
6 | <AssemblyName>WixToolset.WixBA</AssemblyName> | 8 | <AssemblyName>WixToolset.WixBA</AssemblyName> |
7 | <RootNamespace>WixToolset.WixBA</RootNamespace> | 9 | <RootNamespace>WixToolset.WixBA</RootNamespace> |
8 | <DebugType>embedded</DebugType> | 10 | <DebugType>embedded</DebugType> |
@@ -15,17 +17,21 @@ | |||
15 | <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> | 17 | <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
16 | <EnableDynamicLoading>true</EnableDynamicLoading> | 18 | <EnableDynamicLoading>true</EnableDynamicLoading> |
17 | <UseWPF>true</UseWPF> | 19 | <UseWPF>true</UseWPF> |
20 | <SelfContained>false</SelfContained> | ||
18 | <RollForward>Major</RollForward> | 21 | <RollForward>Major</RollForward> |
19 | <!-- https://stackoverflow.com/questions/58844785/how-to-reference-system-windows-forms-in-net-core-3-0-for-wpf-apps --> | 22 | <!-- https://stackoverflow.com/questions/58844785/how-to-reference-system-windows-forms-in-net-core-3-0-for-wpf-apps --> |
20 | <UseWindowsForms>true</UseWindowsForms> | 23 | <UseWindowsForms>true</UseWindowsForms> |
21 | </PropertyGroup> | 24 | </PropertyGroup> |
25 | |||
22 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'=='.NETFramework' "> | 26 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'=='.NETFramework' "> |
23 | <Content Include="WixBA.BootstrapperCore.config" CopyToOutputDirectory="PreserveNewest" /> | 27 | <Content Include="WixBA.BootstrapperCore.config" CopyToOutputDirectory="PreserveNewest" /> |
24 | </ItemGroup> | 28 | </ItemGroup> |
29 | |||
25 | <ItemGroup> | 30 | <ItemGroup> |
26 | <Resource Include="Resources\logo-white-hollow.png" /> | 31 | <Resource Include="Resources\logo-white-hollow.png" /> |
27 | <Resource Include="Resources\logo-black-hollow.png" /> | 32 | <Resource Include="Resources\logo-black-hollow.png" /> |
28 | </ItemGroup> | 33 | </ItemGroup> |
34 | |||
29 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'=='.NETFramework' "> | 35 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'=='.NETFramework' "> |
30 | <Reference Include="PresentationCore" /> | 36 | <Reference Include="PresentationCore" /> |
31 | <Reference Include="PresentationFramework" /> | 37 | <Reference Include="PresentationFramework" /> |
@@ -37,8 +43,4 @@ | |||
37 | <ItemGroup> | 43 | <ItemGroup> |
38 | <PackageReference Include="WixToolset.Mba.Core" /> | 44 | <PackageReference Include="WixToolset.Mba.Core" /> |
39 | </ItemGroup> | 45 | </ItemGroup> |
40 | 46 | </Project> | |
41 | <ItemGroup Condition=" '$(TargetFrameworkIdentifier)'!='.NETFramework' "> | ||
42 | <PackageReference Include="WixToolset.Dnc.HostGenerator" /> | ||
43 | </ItemGroup> | ||
44 | </Project> \ No newline at end of file | ||