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. --- .../examples/EarliestCoreMBA/EarliestCoreBA.cs | 34 ++++++++++++++++++++++ .../EarliestCoreMBA/EarliestCoreBAFactory.cs | 22 ++++++++++++++ .../EarliestCoreMBA/Example.EarliestCoreMBA.csproj | 18 ++++++++++++ 3 files changed, 74 insertions(+) create mode 100644 src/test/examples/EarliestCoreMBA/EarliestCoreBA.cs create mode 100644 src/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs create mode 100644 src/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj (limited to 'src/test/examples/EarliestCoreMBA') diff --git a/src/test/examples/EarliestCoreMBA/EarliestCoreBA.cs b/src/test/examples/EarliestCoreMBA/EarliestCoreBA.cs new file mode 100644 index 00000000..c9291a7f --- /dev/null +++ b/src/test/examples/EarliestCoreMBA/EarliestCoreBA.cs @@ -0,0 +1,34 @@ +// 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.EarliestCoreMBA +{ + using WixToolset.Mba.Core; + + public class EarliestCoreBA : BootstrapperApplication + { + public EarliestCoreBA(IEngine engine) + : base(engine) + { + + } + + protected override void Run() + { + } + + protected override void OnStartup(StartupEventArgs args) + { + base.OnStartup(args); + + this.engine.Log(LogLevel.Standard, nameof(EarliestCoreBA)); + } + + 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/EarliestCoreMBA/EarliestCoreBAFactory.cs b/src/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs new file mode 100644 index 00000000..672e17ee --- /dev/null +++ b/src/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs @@ -0,0 +1,22 @@ +// 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.EarliestCoreMBA.EarliestCoreBAFactory))] +namespace Example.EarliestCoreMBA +{ + using WixToolset.Mba.Core; + + public class EarliestCoreBAFactory : 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 EarliestCoreBA(engine); + } + } +} diff --git a/src/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj b/src/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj new file mode 100644 index 00000000..326633ba --- /dev/null +++ b/src/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj @@ -0,0 +1,18 @@ + + + + netcoreapp3.0 + win-x86;win-x64 + true + Earliest .NET Core MBA + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3-55-g6feb