From 39e930d9aaff250e0fd5019eeedaa40717a6c6fe Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Wed, 29 Apr 2020 19:28:50 +1000 Subject: Add DotNetCoreBootstrapperApplicationHost for an SCD-style .NET Core BA. --- .../LatestCoreMBA/Example.LatestCoreMBA.csproj | 23 +++++++++++++++ src/test/examples/LatestCoreMBA/LatestCoreBA.cs | 33 ++++++++++++++++++++++ .../examples/LatestCoreMBA/LatestCoreBAFactory.cs | 22 +++++++++++++++ 3 files changed, 78 insertions(+) create mode 100644 src/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj create mode 100644 src/test/examples/LatestCoreMBA/LatestCoreBA.cs create mode 100644 src/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs (limited to 'src/test/examples/LatestCoreMBA') diff --git a/src/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj b/src/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj new file mode 100644 index 00000000..1d325b1b --- /dev/null +++ b/src/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj @@ -0,0 +1,23 @@ + + + + netcoreapp3.1 + win-x86;win-x64 + true + Latest .NET Core MBA + + + + false + true + + + + + + + + + + + \ No newline at end of file diff --git a/src/test/examples/LatestCoreMBA/LatestCoreBA.cs b/src/test/examples/LatestCoreMBA/LatestCoreBA.cs new file mode 100644 index 00000000..50386a87 --- /dev/null +++ b/src/test/examples/LatestCoreMBA/LatestCoreBA.cs @@ -0,0 +1,33 @@ +// 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. + +namespace Example.LatestCoreMBA +{ + using WixToolset.Mba.Core; + + public class LatestCoreBA : BootstrapperApplication + { + public LatestCoreBA(IEngine engine) + : base(engine) + { + } + + protected override void Run() + { + } + + protected override void OnStartup(StartupEventArgs args) + { + base.OnStartup(args); + + this.engine.Log(LogLevel.Standard, nameof(LatestCoreBA)); + } + + protected override void OnShutdown(ShutdownEventArgs args) + { + base.OnShutdown(args); + + var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); + this.engine.Log(LogLevel.Standard, message); + } + } +} diff --git a/src/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs b/src/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs new file mode 100644 index 00000000..fff3b5c5 --- /dev/null +++ b/src/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs @@ -0,0 +1,22 @@ +// 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. + +[assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Example.LatestCoreMBA.LatestCoreBAFactory))] +namespace Example.LatestCoreMBA +{ + using WixToolset.Mba.Core; + + public class LatestCoreBAFactory : BaseBootstrapperApplicationFactory + { + private static int loadCount = 0; + + protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) + { + if (loadCount > 0) + { + engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)"); + } + ++loadCount; + return new LatestCoreBA(engine); + } + } +} -- cgit v1.2.3-55-g6feb