diff options
| author | Rob Mensching <rob@firegiant.com> | 2021-05-11 07:48:19 -0700 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2021-05-11 07:48:19 -0700 |
| commit | 32112ecd939d36cd14603f09283f825dea4f07c8 (patch) | |
| tree | 462ab108952a0c67f9140dfeaf0b4fa079f87199 /src/ext/Bal/test/examples | |
| parent | 0923aba915ca2450cc87e3e2c6c0e4e3d2b28294 (diff) | |
| parent | ba7bab476501c16e437b0aee71c1be02c3dda176 (diff) | |
| download | wix-32112ecd939d36cd14603f09283f825dea4f07c8.tar.gz wix-32112ecd939d36cd14603f09283f825dea4f07c8.tar.bz2 wix-32112ecd939d36cd14603f09283f825dea4f07c8.zip | |
Merge Bal.wixext
Diffstat (limited to 'src/ext/Bal/test/examples')
60 files changed, 1447 insertions, 0 deletions
diff --git a/src/ext/Bal/test/examples/Directory.Build.props b/src/ext/Bal/test/examples/Directory.Build.props new file mode 100644 index 00000000..3d5870a5 --- /dev/null +++ b/src/ext/Bal/test/examples/Directory.Build.props | |||
| @@ -0,0 +1,6 @@ | |||
| 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="..\..\Directory.Build.props" /> | ||
| 5 | <Import Project="Wix.Build.props" Condition=" '$(MSBuildProjectExtension)'=='.wixproj' " /> | ||
| 6 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/Directory.Build.targets b/src/ext/Bal/test/examples/Directory.Build.targets new file mode 100644 index 00000000..6dcf402b --- /dev/null +++ b/src/ext/Bal/test/examples/Directory.Build.targets | |||
| @@ -0,0 +1,6 @@ | |||
| 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="..\..\Directory.Build.targets" /> | ||
| 5 | <Import Project="Wix.Build.targets" Condition=" '$(MSBuildProjectExtension)'=='.wixproj' " /> | ||
| 6 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleFDD/EarliestCoreBundleFDD.wixproj b/src/ext/Bal/test/examples/EarliestCoreBundleFDD/EarliestCoreBundleFDD.wixproj new file mode 100644 index 00000000..ba75a9ff --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleFDD/EarliestCoreBundleFDD.wixproj | |||
| @@ -0,0 +1,2 @@ | |||
| 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 | <Project Sdk="WixToolset.Sdk" /> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs b/src/ext/Bal/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs new file mode 100644 index 00000000..d146845c --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleFDD/FrameworkDependentBundle.wxs | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
| 2 | <Bundle Name="FDDEarliestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
| 3 | <BootstrapperApplication> | ||
| 4 | <Payload SourceFile="publish\Example.EarliestCoreMBA\fdd\Example.EarliestCoreMBA.deps.json" Name="Example.EarliestCoreMBA.deps.json" /> | ||
| 5 | <Payload SourceFile="publish\Example.EarliestCoreMBA\fdd\Example.EarliestCoreMBA.dll" Name="Example.EarliestCoreMBA.dll" bal:BAFactoryAssembly="yes" /> | ||
| 6 | <Payload SourceFile="publish\Example.EarliestCoreMBA\fdd\Example.EarliestCoreMBA.pdb" Name="Example.EarliestCoreMBA.pdb" /> | ||
| 7 | <Payload SourceFile="publish\Example.EarliestCoreMBA\fdd\Example.EarliestCoreMBA.runtimeconfig.json" Name="Example.EarliestCoreMBA.runtimeconfig.json" /> | ||
| 8 | <Payload SourceFile="publish\Example.EarliestCoreMBA\fdd\mbanative.dll" Name="mbanative.dll" /> | ||
| 9 | <Payload SourceFile="publish\Example.EarliestCoreMBA\fdd\WixToolset.Mba.Core.dll" Name="WixToolset.Mba.Core.dll" /> | ||
| 10 | <bal:WixDotNetCoreBootstrapperApplicationHost /> | ||
| 11 | </BootstrapperApplication> | ||
| 12 | <Chain> | ||
| 13 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" bal:PrereqPackage="yes" /> | ||
| 14 | </Chain> | ||
| 15 | </Bundle> | ||
| 16 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleSCD/EarliestCoreBundleSCD.wixproj b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/EarliestCoreBundleSCD.wixproj new file mode 100644 index 00000000..ebeebff2 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/EarliestCoreBundleSCD.wixproj | |||
| @@ -0,0 +1,10 @@ | |||
| 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 | <Project Sdk="WixToolset.Sdk"> | ||
| 3 | <ItemGroup> | ||
| 4 | <BindInputPaths Include="$(OutputPath)publish\Example.EarliestCoreMBA\scd" /> | ||
| 5 | <HarvestDirectory Include="$(OutputPath)publish\Example.EarliestCoreMBA\scd"> | ||
| 6 | <DirectoryRefId>publish.Example.EarliestCoreMBA.scd</DirectoryRefId> | ||
| 7 | <Transforms>ba.xslt</Transforms> | ||
| 8 | </HarvestDirectory> | ||
| 9 | </ItemGroup> | ||
| 10 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs new file mode 100644 index 00000000..4d872317 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/SelfContainedBundle.wxs | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
| 2 | <Bundle Name="SCDEarliestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
| 3 | <BootstrapperApplication> | ||
| 4 | <bal:WixDotNetCoreBootstrapperApplicationHost SelfContainedDeployment="yes" /> | ||
| 5 | <PayloadGroupRef Id="publish.Example.EarliestCoreMBA.scd" /> | ||
| 6 | </BootstrapperApplication> | ||
| 7 | <Chain> | ||
| 8 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" PerMachine="yes" /> | ||
| 9 | </Chain> | ||
| 10 | </Bundle> | ||
| 11 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleSCD/ba.xslt b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/ba.xslt new file mode 100644 index 00000000..06b84256 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleSCD/ba.xslt | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
| 3 | xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" | ||
| 4 | xmlns:wix="http://wixtoolset.org/schemas/v4/wxs" | ||
| 5 | > | ||
| 6 | <xsl:output method="xml" indent="yes"/> | ||
| 7 | |||
| 8 | <xsl:template match="@* | node()"> | ||
| 9 | <xsl:copy> | ||
| 10 | <xsl:apply-templates select="@* | node()"/> | ||
| 11 | </xsl:copy> | ||
| 12 | </xsl:template> | ||
| 13 | |||
| 14 | <xsl:template match="wix:Payload[@SourceFile='SourceDir\Example.EarliestCoreMBA.dll']" > | ||
| 15 | <xsl:copy> | ||
| 16 | <xsl:attribute name="BAFactoryAssembly" namespace="http://wixtoolset.org/schemas/v4/wxs/bal">yes</xsl:attribute> | ||
| 17 | <xsl:apply-templates select="@* | node()"/> | ||
| 18 | </xsl:copy> | ||
| 19 | </xsl:template> | ||
| 20 | </xsl:stylesheet> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/EarliestCoreBundleTrimmedSCD.wixproj b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/EarliestCoreBundleTrimmedSCD.wixproj new file mode 100644 index 00000000..a6b56460 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/EarliestCoreBundleTrimmedSCD.wixproj | |||
| @@ -0,0 +1,10 @@ | |||
| 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 | <Project Sdk="WixToolset.Sdk"> | ||
| 3 | <ItemGroup> | ||
| 4 | <BindInputPaths Include="$(OutputPath)publish\Example.EarliestCoreMBA\trimmedscd" /> | ||
| 5 | <HarvestDirectory Include="$(OutputPath)publish\Example.EarliestCoreMBA\trimmedscd"> | ||
| 6 | <DirectoryRefId>publish.Example.EarliestCoreMBA.trimmedscd</DirectoryRefId> | ||
| 7 | <Transforms>ba.xslt</Transforms> | ||
| 8 | </HarvestDirectory> | ||
| 9 | </ItemGroup> | ||
| 10 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs new file mode 100644 index 00000000..ba7dce25 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
| 2 | <Bundle Name="TrimmedSCDEarliestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
| 3 | <BootstrapperApplication> | ||
| 4 | <bal:WixDotNetCoreBootstrapperApplicationHost SelfContainedDeployment="yes" /> | ||
| 5 | <PayloadGroupRef Id="publish.Example.EarliestCoreMBA.trimmedscd" /> | ||
| 6 | </BootstrapperApplication> | ||
| 7 | <Chain> | ||
| 8 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" PerMachine="yes" /> | ||
| 9 | </Chain> | ||
| 10 | </Bundle> | ||
| 11 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/ba.xslt b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/ba.xslt new file mode 100644 index 00000000..06b84256 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreBundleTrimmedSCD/ba.xslt | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
| 3 | xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" | ||
| 4 | xmlns:wix="http://wixtoolset.org/schemas/v4/wxs" | ||
| 5 | > | ||
| 6 | <xsl:output method="xml" indent="yes"/> | ||
| 7 | |||
| 8 | <xsl:template match="@* | node()"> | ||
| 9 | <xsl:copy> | ||
| 10 | <xsl:apply-templates select="@* | node()"/> | ||
| 11 | </xsl:copy> | ||
| 12 | </xsl:template> | ||
| 13 | |||
| 14 | <xsl:template match="wix:Payload[@SourceFile='SourceDir\Example.EarliestCoreMBA.dll']" > | ||
| 15 | <xsl:copy> | ||
| 16 | <xsl:attribute name="BAFactoryAssembly" namespace="http://wixtoolset.org/schemas/v4/wxs/bal">yes</xsl:attribute> | ||
| 17 | <xsl:apply-templates select="@* | node()"/> | ||
| 18 | </xsl:copy> | ||
| 19 | </xsl:template> | ||
| 20 | </xsl:stylesheet> | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBA.cs b/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBA.cs new file mode 100644 index 00000000..c9291a7f --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBA.cs | |||
| @@ -0,0 +1,34 @@ | |||
| 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 Example.EarliestCoreMBA | ||
| 4 | { | ||
| 5 | using WixToolset.Mba.Core; | ||
| 6 | |||
| 7 | public class EarliestCoreBA : BootstrapperApplication | ||
| 8 | { | ||
| 9 | public EarliestCoreBA(IEngine engine) | ||
| 10 | : base(engine) | ||
| 11 | { | ||
| 12 | |||
| 13 | } | ||
| 14 | |||
| 15 | protected override void Run() | ||
| 16 | { | ||
| 17 | } | ||
| 18 | |||
| 19 | protected override void OnStartup(StartupEventArgs args) | ||
| 20 | { | ||
| 21 | base.OnStartup(args); | ||
| 22 | |||
| 23 | this.engine.Log(LogLevel.Standard, nameof(EarliestCoreBA)); | ||
| 24 | } | ||
| 25 | |||
| 26 | protected override void OnShutdown(ShutdownEventArgs args) | ||
| 27 | { | ||
| 28 | base.OnShutdown(args); | ||
| 29 | |||
| 30 | var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); | ||
| 31 | this.engine.Log(LogLevel.Standard, message); | ||
| 32 | } | ||
| 33 | } | ||
| 34 | } | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs b/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs new file mode 100644 index 00000000..672e17ee --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreMBA/EarliestCoreBAFactory.cs | |||
| @@ -0,0 +1,22 @@ | |||
| 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 | [assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Example.EarliestCoreMBA.EarliestCoreBAFactory))] | ||
| 4 | namespace Example.EarliestCoreMBA | ||
| 5 | { | ||
| 6 | using WixToolset.Mba.Core; | ||
| 7 | |||
| 8 | public class EarliestCoreBAFactory : BaseBootstrapperApplicationFactory | ||
| 9 | { | ||
| 10 | private static int loadCount = 0; | ||
| 11 | |||
| 12 | protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) | ||
| 13 | { | ||
| 14 | if (loadCount > 0) | ||
| 15 | { | ||
| 16 | engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)"); | ||
| 17 | } | ||
| 18 | ++loadCount; | ||
| 19 | return new EarliestCoreBA(engine); | ||
| 20 | } | ||
| 21 | } | ||
| 22 | } | ||
diff --git a/src/ext/Bal/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj b/src/ext/Bal/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj new file mode 100644 index 00000000..cb66c138 --- /dev/null +++ b/src/ext/Bal/test/examples/EarliestCoreMBA/Example.EarliestCoreMBA.csproj | |||
| @@ -0,0 +1,18 @@ | |||
| 1 | <Project Sdk="Microsoft.NET.Sdk"> | ||
| 2 | |||
| 3 | <PropertyGroup> | ||
| 4 | <TargetFramework>netcoreapp3.1</TargetFramework> | ||
| 5 | <RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers> | ||
| 6 | <EnableDynamicLoading>true</EnableDynamicLoading> | ||
| 7 | <Description>Earliest .NET Core MBA</Description> | ||
| 8 | </PropertyGroup> | ||
| 9 | |||
| 10 | <ItemGroup> | ||
| 11 | <TrimmerRootAssembly Include="System.Runtime.Loader" /> | ||
| 12 | </ItemGroup> | ||
| 13 | |||
| 14 | <ItemGroup> | ||
| 15 | <PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" /> | ||
| 16 | <PackageReference Include="WixToolset.Mba.Core" Version="4.0.*" /> | ||
| 17 | </ItemGroup> | ||
| 18 | </Project> \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/examples/FullFramework2Bundle/Bundle.wxs b/src/ext/Bal/test/examples/FullFramework2Bundle/Bundle.wxs new file mode 100644 index 00000000..f0af975c --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2Bundle/Bundle.wxs | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
| 2 | <Bundle Name="FullFramework2MBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
| 3 | <BootstrapperApplication> | ||
| 4 | <Payload SourceFile="Example.FullFramework2MBA\net20\win-x86\Example.FullFramework2MBA.dll" /> | ||
| 5 | <Payload SourceFile="Example.FullFramework2MBA\net20\win-x86\mbanative.dll" /> | ||
| 6 | <Payload SourceFile="Example.FullFramework2MBA\net20\win-x86\WixToolset.Mba.Core.dll" /> | ||
| 7 | <Payload SourceFile="Example.FullFramework2MBA\net20\win-x86\WixToolset.Mba.Host.config" /> | ||
| 8 | <bal:WixManagedBootstrapperApplicationHost /> | ||
| 9 | </BootstrapperApplication> | ||
| 10 | <Chain> | ||
| 11 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" bal:PrereqPackage="yes" /> | ||
| 12 | </Chain> | ||
| 13 | </Bundle> | ||
| 14 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/FullFramework2Bundle/FullFramework2Bundle.wixproj b/src/ext/Bal/test/examples/FullFramework2Bundle/FullFramework2Bundle.wixproj new file mode 100644 index 00000000..ba75a9ff --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2Bundle/FullFramework2Bundle.wixproj | |||
| @@ -0,0 +1,2 @@ | |||
| 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 | <Project Sdk="WixToolset.Sdk" /> | ||
diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj b/src/ext/Bal/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj new file mode 100644 index 00000000..21079ed1 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj | |||
| @@ -0,0 +1,20 @@ | |||
| 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>net20</TargetFramework> | ||
| 7 | <AssemblyName>Example.FullFramework2MBA</AssemblyName> | ||
| 8 | <RootNamespace>Example.FullFramework2MBA</RootNamespace> | ||
| 9 | <DebugType>embedded</DebugType> | ||
| 10 | <RuntimeIdentifier>win-x86</RuntimeIdentifier> | ||
| 11 | </PropertyGroup> | ||
| 12 | |||
| 13 | <ItemGroup> | ||
| 14 | <Content Include="WixToolset.Mba.Host.config" CopyToOutputDirectory="PreserveNewest" /> | ||
| 15 | </ItemGroup> | ||
| 16 | |||
| 17 | <ItemGroup> | ||
| 18 | <PackageReference Include="WixToolset.Mba.Core" Version="4.0.*" /> | ||
| 19 | </ItemGroup> | ||
| 20 | </Project> \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BA.cs b/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BA.cs new file mode 100644 index 00000000..32cd19c8 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BA.cs | |||
| @@ -0,0 +1,34 @@ | |||
| 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 Example.FullFramework2MBA | ||
| 4 | { | ||
| 5 | using WixToolset.Mba.Core; | ||
| 6 | |||
| 7 | public class FullFramework2BA : BootstrapperApplication | ||
| 8 | { | ||
| 9 | public FullFramework2BA(IEngine engine) | ||
| 10 | : base(engine) | ||
| 11 | { | ||
| 12 | |||
| 13 | } | ||
| 14 | |||
| 15 | protected override void Run() | ||
| 16 | { | ||
| 17 | } | ||
| 18 | |||
| 19 | protected override void OnStartup(StartupEventArgs args) | ||
| 20 | { | ||
| 21 | base.OnStartup(args); | ||
| 22 | |||
| 23 | this.engine.Log(LogLevel.Standard, nameof(FullFramework2BA)); | ||
| 24 | } | ||
| 25 | |||
| 26 | protected override void OnShutdown(ShutdownEventArgs args) | ||
| 27 | { | ||
| 28 | base.OnShutdown(args); | ||
| 29 | |||
| 30 | var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); | ||
| 31 | this.engine.Log(LogLevel.Standard, message); | ||
| 32 | } | ||
| 33 | } | ||
| 34 | } | ||
diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs b/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs new file mode 100644 index 00000000..647c2040 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs | |||
| @@ -0,0 +1,22 @@ | |||
| 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 | [assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Example.FullFramework2MBA.FullFramework2BAFactory))] | ||
| 4 | namespace Example.FullFramework2MBA | ||
| 5 | { | ||
| 6 | using WixToolset.Mba.Core; | ||
| 7 | |||
| 8 | public class FullFramework2BAFactory : BaseBootstrapperApplicationFactory | ||
| 9 | { | ||
| 10 | private static int loadCount = 0; | ||
| 11 | |||
| 12 | protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) | ||
| 13 | { | ||
| 14 | if (loadCount > 0) | ||
| 15 | { | ||
| 16 | engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)"); | ||
| 17 | } | ||
| 18 | ++loadCount; | ||
| 19 | return new FullFramework2BA(engine); | ||
| 20 | } | ||
| 21 | } | ||
| 22 | } | ||
diff --git a/src/ext/Bal/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config b/src/ext/Bal/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config new file mode 100644 index 00000000..be450a4f --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config | |||
| @@ -0,0 +1,20 @@ | |||
| 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 | |||
| 5 | <configuration> | ||
| 6 | <configSections> | ||
| 7 | <sectionGroup name="wix.bootstrapper" type="WixToolset.Mba.Host.BootstrapperSectionGroup, WixToolset.Mba.Host"> | ||
| 8 | <section name="host" type="WixToolset.Mba.Host.HostSection, WixToolset.Mba.Host" /> | ||
| 9 | </sectionGroup> | ||
| 10 | </configSections> | ||
| 11 | <startup> | ||
| 12 | <supportedRuntime version="v2.0.50727" /> | ||
| 13 | </startup> | ||
| 14 | <wix.bootstrapper> | ||
| 15 | |||
| 16 | <host assemblyName="Example.FullFramework2MBA"> | ||
| 17 | <supportedFramework version="v3.5" /> | ||
| 18 | </host> | ||
| 19 | </wix.bootstrapper> | ||
| 20 | </configuration> | ||
diff --git a/src/ext/Bal/test/examples/FullFramework4Bundle/Bundle.wxs b/src/ext/Bal/test/examples/FullFramework4Bundle/Bundle.wxs new file mode 100644 index 00000000..7b7cbf57 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4Bundle/Bundle.wxs | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
| 2 | <Bundle Name="FullFramework4MBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="E08068E0-4FBA-439D-A1C8-4CD1FE27093F"> | ||
| 3 | <BootstrapperApplication> | ||
| 4 | <Payload SourceFile="Example.FullFramework4MBA\net48\win-x86\Example.FullFramework4MBA.dll" /> | ||
| 5 | <Payload SourceFile="Example.FullFramework4MBA\net48\win-x86\mbanative.dll" /> | ||
| 6 | <Payload SourceFile="Example.FullFramework4MBA\net48\win-x86\WixToolset.Mba.Core.dll" /> | ||
| 7 | <Payload SourceFile="Example.FullFramework4MBA\net48\win-x86\WixToolset.Mba.Host.config" /> | ||
| 8 | <bal:WixManagedBootstrapperApplicationHost /> | ||
| 9 | </BootstrapperApplication> | ||
| 10 | <Chain> | ||
| 11 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" bal:PrereqPackage="yes" /> | ||
| 12 | </Chain> | ||
| 13 | </Bundle> | ||
| 14 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/FullFramework4Bundle/FullFramework4Bundle.wixproj b/src/ext/Bal/test/examples/FullFramework4Bundle/FullFramework4Bundle.wixproj new file mode 100644 index 00000000..ba75a9ff --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4Bundle/FullFramework4Bundle.wixproj | |||
| @@ -0,0 +1,2 @@ | |||
| 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 | <Project Sdk="WixToolset.Sdk" /> | ||
diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj b/src/ext/Bal/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj new file mode 100644 index 00000000..a05e7888 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj | |||
| @@ -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 | |||
| 4 | <Project Sdk="Microsoft.NET.Sdk"> | ||
| 5 | <PropertyGroup> | ||
| 6 | <TargetFramework>net48</TargetFramework> | ||
| 7 | <Description>Full Framework v4 MBA</Description> | ||
| 8 | <RuntimeIdentifier>win-x86</RuntimeIdentifier> | ||
| 9 | </PropertyGroup> | ||
| 10 | |||
| 11 | <ItemGroup> | ||
| 12 | <PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" /> | ||
| 13 | <PackageReference Include="WixToolset.Mba.Core" Version="4.0.*" PrivateAssets="All" /> | ||
| 14 | </ItemGroup> | ||
| 15 | |||
| 16 | <ItemGroup> | ||
| 17 | <Content Include="WixToolset.Mba.Host.config" CopyToOutputDirectory="PreserveNewest" /> | ||
| 18 | </ItemGroup> | ||
| 19 | </Project> \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BA.cs b/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BA.cs new file mode 100644 index 00000000..8ee3bd19 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BA.cs | |||
| @@ -0,0 +1,34 @@ | |||
| 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 Example.FullFramework4MBA | ||
| 4 | { | ||
| 5 | using WixToolset.Mba.Core; | ||
| 6 | |||
| 7 | public class FullFramework4BA : BootstrapperApplication | ||
| 8 | { | ||
| 9 | public FullFramework4BA(IEngine engine) | ||
| 10 | : base(engine) | ||
| 11 | { | ||
| 12 | |||
| 13 | } | ||
| 14 | |||
| 15 | protected override void Run() | ||
| 16 | { | ||
| 17 | } | ||
| 18 | |||
| 19 | protected override void OnStartup(StartupEventArgs args) | ||
| 20 | { | ||
| 21 | base.OnStartup(args); | ||
| 22 | |||
| 23 | this.engine.Log(LogLevel.Standard, nameof(FullFramework4BA)); | ||
| 24 | } | ||
| 25 | |||
| 26 | protected override void OnShutdown(ShutdownEventArgs args) | ||
| 27 | { | ||
| 28 | base.OnShutdown(args); | ||
| 29 | |||
| 30 | var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); | ||
| 31 | this.engine.Log(LogLevel.Standard, message); | ||
| 32 | } | ||
| 33 | } | ||
| 34 | } | ||
diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs b/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs new file mode 100644 index 00000000..6a571a54 --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs | |||
| @@ -0,0 +1,22 @@ | |||
| 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 | [assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Example.FullFramework4MBA.FullFramework4BAFactory))] | ||
| 4 | namespace Example.FullFramework4MBA | ||
| 5 | { | ||
| 6 | using WixToolset.Mba.Core; | ||
| 7 | |||
| 8 | public class FullFramework4BAFactory : BaseBootstrapperApplicationFactory | ||
| 9 | { | ||
| 10 | private static int loadCount = 0; | ||
| 11 | |||
| 12 | protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) | ||
| 13 | { | ||
| 14 | if (loadCount > 0) | ||
| 15 | { | ||
| 16 | engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)"); | ||
| 17 | } | ||
| 18 | ++loadCount; | ||
| 19 | return new FullFramework4BA(engine); | ||
| 20 | } | ||
| 21 | } | ||
| 22 | } | ||
diff --git a/src/ext/Bal/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config b/src/ext/Bal/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config new file mode 100644 index 00000000..96678cda --- /dev/null +++ b/src/ext/Bal/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config | |||
| @@ -0,0 +1,17 @@ | |||
| 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 | |||
| 5 | <configuration> | ||
| 6 | <configSections> | ||
| 7 | <sectionGroup name="wix.bootstrapper" type="WixToolset.Mba.Host.BootstrapperSectionGroup, WixToolset.Mba.Host"> | ||
| 8 | <section name="host" type="WixToolset.Mba.Host.HostSection, WixToolset.Mba.Host" /> | ||
| 9 | </sectionGroup> | ||
| 10 | </configSections> | ||
| 11 | <startup> | ||
| 12 | <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" /> | ||
| 13 | </startup> | ||
| 14 | <wix.bootstrapper> | ||
| 15 | <host assemblyName="Example.FullFramework4MBA" /> | ||
| 16 | </wix.bootstrapper> | ||
| 17 | </configuration> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs b/src/ext/Bal/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs new file mode 100644 index 00000000..d5b543e8 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleFDD/FrameworkDependentBundle.wxs | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
| 2 | <Bundle Name="FDDLatestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
| 3 | <BootstrapperApplication> | ||
| 4 | <Payload SourceFile="publish\Example.LatestCoreMBA\fdd\Example.LatestCoreMBA.deps.json" Name="Example.LatestCoreMBA.deps.json" /> | ||
| 5 | <Payload SourceFile="publish\Example.LatestCoreMBA\fdd\Example.LatestCoreMBA.dll" Name="Example.LatestCoreMBA.dll" bal:BAFactoryAssembly="yes" /> | ||
| 6 | <Payload SourceFile="publish\Example.LatestCoreMBA\fdd\Example.LatestCoreMBA.pdb" Name="Example.LatestCoreMBA.pdb" /> | ||
| 7 | <Payload SourceFile="publish\Example.LatestCoreMBA\fdd\Example.LatestCoreMBA.runtimeconfig.json" Name="Example.LatestCoreMBA.runtimeconfig.json" /> | ||
| 8 | <Payload SourceFile="publish\Example.LatestCoreMBA\fdd\mbanative.dll" Name="mbanative.dll" /> | ||
| 9 | <Payload SourceFile="publish\Example.LatestCoreMBA\fdd\WixToolset.Mba.Core.dll" Name="WixToolset.Mba.Core.dll" /> | ||
| 10 | <bal:WixDotNetCoreBootstrapperApplicationHost /> | ||
| 11 | </BootstrapperApplication> | ||
| 12 | <Chain> | ||
| 13 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" bal:PrereqPackage="yes" /> | ||
| 14 | </Chain> | ||
| 15 | </Bundle> | ||
| 16 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreBundleFDD/LatestCoreBundleFDD.wixproj b/src/ext/Bal/test/examples/LatestCoreBundleFDD/LatestCoreBundleFDD.wixproj new file mode 100644 index 00000000..ba75a9ff --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleFDD/LatestCoreBundleFDD.wixproj | |||
| @@ -0,0 +1,2 @@ | |||
| 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 | <Project Sdk="WixToolset.Sdk" /> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreBundleSCD/LatestCoreBundleSCD.wixproj b/src/ext/Bal/test/examples/LatestCoreBundleSCD/LatestCoreBundleSCD.wixproj new file mode 100644 index 00000000..30a860ab --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleSCD/LatestCoreBundleSCD.wixproj | |||
| @@ -0,0 +1,10 @@ | |||
| 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 | <Project Sdk="WixToolset.Sdk"> | ||
| 3 | <ItemGroup> | ||
| 4 | <BindInputPaths Include="$(OutputPath)publish\Example.LatestCoreMBA\scd" /> | ||
| 5 | <HarvestDirectory Include="$(OutputPath)publish\Example.LatestCoreMBA\scd"> | ||
| 6 | <DirectoryRefId>publish.Example.LatestCoreMBA.scd</DirectoryRefId> | ||
| 7 | <Transforms>ba.xslt</Transforms> | ||
| 8 | </HarvestDirectory> | ||
| 9 | </ItemGroup> | ||
| 10 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs b/src/ext/Bal/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs new file mode 100644 index 00000000..bedf0326 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleSCD/SelfContainedBundle.wxs | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
| 2 | <Bundle Name="SCDLatestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
| 3 | <BootstrapperApplication> | ||
| 4 | <bal:WixDotNetCoreBootstrapperApplicationHost SelfContainedDeployment="yes" /> | ||
| 5 | <PayloadGroupRef Id="publish.Example.LatestCoreMBA.scd" /> | ||
| 6 | </BootstrapperApplication> | ||
| 7 | <Chain> | ||
| 8 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" PerMachine="yes" /> | ||
| 9 | </Chain> | ||
| 10 | </Bundle> | ||
| 11 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreBundleSCD/ba.xslt b/src/ext/Bal/test/examples/LatestCoreBundleSCD/ba.xslt new file mode 100644 index 00000000..acc7474c --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleSCD/ba.xslt | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
| 3 | xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" | ||
| 4 | xmlns:wix="http://wixtoolset.org/schemas/v4/wxs" | ||
| 5 | > | ||
| 6 | <xsl:output method="xml" indent="yes"/> | ||
| 7 | |||
| 8 | <xsl:template match="@* | node()"> | ||
| 9 | <xsl:copy> | ||
| 10 | <xsl:apply-templates select="@* | node()"/> | ||
| 11 | </xsl:copy> | ||
| 12 | </xsl:template> | ||
| 13 | |||
| 14 | <xsl:template match="wix:Payload[@SourceFile='SourceDir\Example.LatestCoreMBA.dll']" > | ||
| 15 | <xsl:copy> | ||
| 16 | <xsl:attribute name="BAFactoryAssembly" namespace="http://wixtoolset.org/schemas/v4/wxs/bal">yes</xsl:attribute> | ||
| 17 | <xsl:apply-templates select="@* | node()"/> | ||
| 18 | </xsl:copy> | ||
| 19 | </xsl:template> | ||
| 20 | </xsl:stylesheet> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/LatestCoreBundleTrimmedSCD.wixproj b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/LatestCoreBundleTrimmedSCD.wixproj new file mode 100644 index 00000000..5ce89b64 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/LatestCoreBundleTrimmedSCD.wixproj | |||
| @@ -0,0 +1,10 @@ | |||
| 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 | <Project Sdk="WixToolset.Sdk"> | ||
| 3 | <ItemGroup> | ||
| 4 | <BindInputPaths Include="$(OutputPath)publish\Example.LatestCoreMBA\trimmedscd" /> | ||
| 5 | <HarvestDirectory Include="$(OutputPath)publish\Example.LatestCoreMBA\trimmedscd"> | ||
| 6 | <DirectoryRefId>publish.Example.LatestCoreMBA.trimmedscd</DirectoryRefId> | ||
| 7 | <Transforms>ba.xslt</Transforms> | ||
| 8 | </HarvestDirectory> | ||
| 9 | </ItemGroup> | ||
| 10 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs new file mode 100644 index 00000000..6059f8c1 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/TrimmedSelfContainedBundle.wxs | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
| 2 | <Bundle Name="TrimmedSCDLatestCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
| 3 | <BootstrapperApplication> | ||
| 4 | <bal:WixDotNetCoreBootstrapperApplicationHost SelfContainedDeployment="yes" /> | ||
| 5 | <PayloadGroupRef Id="publish.Example.LatestCoreMBA.trimmedscd" /> | ||
| 6 | </BootstrapperApplication> | ||
| 7 | <Chain> | ||
| 8 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" PerMachine="yes" /> | ||
| 9 | </Chain> | ||
| 10 | </Bundle> | ||
| 11 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/ba.xslt b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/ba.xslt new file mode 100644 index 00000000..acc7474c --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreBundleTrimmedSCD/ba.xslt | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
| 3 | xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl" | ||
| 4 | xmlns:wix="http://wixtoolset.org/schemas/v4/wxs" | ||
| 5 | > | ||
| 6 | <xsl:output method="xml" indent="yes"/> | ||
| 7 | |||
| 8 | <xsl:template match="@* | node()"> | ||
| 9 | <xsl:copy> | ||
| 10 | <xsl:apply-templates select="@* | node()"/> | ||
| 11 | </xsl:copy> | ||
| 12 | </xsl:template> | ||
| 13 | |||
| 14 | <xsl:template match="wix:Payload[@SourceFile='SourceDir\Example.LatestCoreMBA.dll']" > | ||
| 15 | <xsl:copy> | ||
| 16 | <xsl:attribute name="BAFactoryAssembly" namespace="http://wixtoolset.org/schemas/v4/wxs/bal">yes</xsl:attribute> | ||
| 17 | <xsl:apply-templates select="@* | node()"/> | ||
| 18 | </xsl:copy> | ||
| 19 | </xsl:template> | ||
| 20 | </xsl:stylesheet> | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj b/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj new file mode 100644 index 00000000..9f3f02d9 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreMBA/Example.LatestCoreMBA.csproj | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | <Project Sdk="Microsoft.NET.Sdk"> | ||
| 2 | |||
| 3 | <PropertyGroup> | ||
| 4 | <TargetFramework>net5.0</TargetFramework> | ||
| 5 | <RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers> | ||
| 6 | <EnableDynamicLoading>true</EnableDynamicLoading> | ||
| 7 | <Description>Latest .NET Core MBA</Description> | ||
| 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="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" /> | ||
| 19 | <PackageReference Include="WixToolset.Mba.Core" Version="4.0.*" /> | ||
| 20 | </ItemGroup> | ||
| 21 | </Project> \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBA.cs b/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBA.cs new file mode 100644 index 00000000..50386a87 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBA.cs | |||
| @@ -0,0 +1,33 @@ | |||
| 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 Example.LatestCoreMBA | ||
| 4 | { | ||
| 5 | using WixToolset.Mba.Core; | ||
| 6 | |||
| 7 | public class LatestCoreBA : BootstrapperApplication | ||
| 8 | { | ||
| 9 | public LatestCoreBA(IEngine engine) | ||
| 10 | : base(engine) | ||
| 11 | { | ||
| 12 | } | ||
| 13 | |||
| 14 | protected override void Run() | ||
| 15 | { | ||
| 16 | } | ||
| 17 | |||
| 18 | protected override void OnStartup(StartupEventArgs args) | ||
| 19 | { | ||
| 20 | base.OnStartup(args); | ||
| 21 | |||
| 22 | this.engine.Log(LogLevel.Standard, nameof(LatestCoreBA)); | ||
| 23 | } | ||
| 24 | |||
| 25 | protected override void OnShutdown(ShutdownEventArgs args) | ||
| 26 | { | ||
| 27 | base.OnShutdown(args); | ||
| 28 | |||
| 29 | var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); | ||
| 30 | this.engine.Log(LogLevel.Standard, message); | ||
| 31 | } | ||
| 32 | } | ||
| 33 | } | ||
diff --git a/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs b/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs new file mode 100644 index 00000000..fff3b5c5 --- /dev/null +++ b/src/ext/Bal/test/examples/LatestCoreMBA/LatestCoreBAFactory.cs | |||
| @@ -0,0 +1,22 @@ | |||
| 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 | [assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Example.LatestCoreMBA.LatestCoreBAFactory))] | ||
| 4 | namespace Example.LatestCoreMBA | ||
| 5 | { | ||
| 6 | using WixToolset.Mba.Core; | ||
| 7 | |||
| 8 | public class LatestCoreBAFactory : BaseBootstrapperApplicationFactory | ||
| 9 | { | ||
| 10 | private static int loadCount = 0; | ||
| 11 | |||
| 12 | protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) | ||
| 13 | { | ||
| 14 | if (loadCount > 0) | ||
| 15 | { | ||
| 16 | engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)"); | ||
| 17 | } | ||
| 18 | ++loadCount; | ||
| 19 | return new LatestCoreBA(engine); | ||
| 20 | } | ||
| 21 | } | ||
| 22 | } | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/Example.TestEngine.vcxproj b/src/ext/Bal/test/examples/TestEngine/Example.TestEngine.vcxproj new file mode 100644 index 00000000..99eb917e --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/Example.TestEngine.vcxproj | |||
| @@ -0,0 +1,83 @@ | |||
| 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 DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| 4 | <Import Project="..\..\..\..\packages\WixToolset.BalUtil.4.0.58\build\WixToolset.BalUtil.props" Condition="Exists('..\..\..\..\packages\WixToolset.BalUtil.4.0.58\build\WixToolset.BalUtil.props')" /> | ||
| 5 | <Import Project="..\..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props')" /> | ||
| 6 | <Import Project="..\..\..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props" Condition="Exists('..\..\..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props')" /> | ||
| 7 | <ItemGroup Label="ProjectConfigurations"> | ||
| 8 | <ProjectConfiguration Include="Debug|ARM64"> | ||
| 9 | <Configuration>Debug</Configuration> | ||
| 10 | <Platform>ARM64</Platform> | ||
| 11 | </ProjectConfiguration> | ||
| 12 | <ProjectConfiguration Include="Release|ARM64"> | ||
| 13 | <Configuration>Release</Configuration> | ||
| 14 | <Platform>ARM64</Platform> | ||
| 15 | </ProjectConfiguration> | ||
| 16 | <ProjectConfiguration Include="Debug|Win32"> | ||
| 17 | <Configuration>Debug</Configuration> | ||
| 18 | <Platform>Win32</Platform> | ||
| 19 | </ProjectConfiguration> | ||
| 20 | <ProjectConfiguration Include="Release|Win32"> | ||
| 21 | <Configuration>Release</Configuration> | ||
| 22 | <Platform>Win32</Platform> | ||
| 23 | </ProjectConfiguration> | ||
| 24 | <ProjectConfiguration Include="Debug|x64"> | ||
| 25 | <Configuration>Debug</Configuration> | ||
| 26 | <Platform>x64</Platform> | ||
| 27 | </ProjectConfiguration> | ||
| 28 | <ProjectConfiguration Include="Release|x64"> | ||
| 29 | <Configuration>Release</Configuration> | ||
| 30 | <Platform>x64</Platform> | ||
| 31 | </ProjectConfiguration> | ||
| 32 | </ItemGroup> | ||
| 33 | <PropertyGroup Label="Globals"> | ||
| 34 | <ProjectGuid>{3D44B67D-A475-49BA-8310-E39F6C117CC9}</ProjectGuid> | ||
| 35 | <ConfigurationType>Application</ConfigurationType> | ||
| 36 | <ProjectSubSystem>Console</ProjectSubSystem> | ||
| 37 | <TargetName>Example.TestEngine</TargetName> | ||
| 38 | <PlatformToolset>v142</PlatformToolset> | ||
| 39 | <CharacterSet>Unicode</CharacterSet> | ||
| 40 | <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> | ||
| 41 | </PropertyGroup> | ||
| 42 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
| 43 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
| 44 | <ImportGroup Label="ExtensionSettings"> | ||
| 45 | </ImportGroup> | ||
| 46 | <ImportGroup Label="Shared"> | ||
| 47 | <Import Project="..\..\..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" /> | ||
| 48 | </ImportGroup> | ||
| 49 | <PropertyGroup> | ||
| 50 | <ProjectAdditionalLinkLibraries> | ||
| 51 | </ProjectAdditionalLinkLibraries> | ||
| 52 | </PropertyGroup> | ||
| 53 | <ItemGroup> | ||
| 54 | <ClCompile Include="precomp.cpp"> | ||
| 55 | <PrecompiledHeader>Create</PrecompiledHeader> | ||
| 56 | </ClCompile> | ||
| 57 | <ClCompile Include="ReloadEngine.cpp" /> | ||
| 58 | <ClCompile Include="ShutdownEngine.cpp" /> | ||
| 59 | <ClCompile Include="ExampleTestEngine.cpp" /> | ||
| 60 | <ClCompile Include="TestEngine.cpp" /> | ||
| 61 | <ClCompile Include="WaitForQuitEngine.cpp" /> | ||
| 62 | </ItemGroup> | ||
| 63 | <ItemGroup> | ||
| 64 | <ClInclude Include="precomp.h" /> | ||
| 65 | <ClInclude Include="ReloadEngine.h" /> | ||
| 66 | <ClInclude Include="ShutdownEngine.h" /> | ||
| 67 | <ClInclude Include="TestEngine.h" /> | ||
| 68 | <ClInclude Include="WaitForQuitEngine.h" /> | ||
| 69 | </ItemGroup> | ||
| 70 | <ItemGroup> | ||
| 71 | <None Include="packages.config" /> | ||
| 72 | </ItemGroup> | ||
| 73 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
| 74 | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
| 75 | <PropertyGroup> | ||
| 76 | <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText> | ||
| 77 | </PropertyGroup> | ||
| 78 | <Error Condition="!Exists('..\..\..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Nerdbank.GitVersioning.3.3.37\build\Nerdbank.GitVersioning.targets'))" /> | ||
| 79 | <Error Condition="!Exists('..\..\..\..\packages\WixToolset.BalUtil.4.0.58\build\WixToolset.BalUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.BalUtil.4.0.58\build\WixToolset.BalUtil.props'))" /> | ||
| 80 | <Error Condition="!Exists('..\..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.141\build\WixToolset.BootstrapperCore.Native.props'))" /> | ||
| 81 | <Error Condition="!Exists('..\..\..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.DUtil.4.0.72\build\WixToolset.DUtil.props'))" /> | ||
| 82 | </Target> | ||
| 83 | </Project> \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/ExampleTestEngine.cpp b/src/ext/Bal/test/examples/TestEngine/ExampleTestEngine.cpp new file mode 100644 index 00000000..fc1938fe --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/ExampleTestEngine.cpp | |||
| @@ -0,0 +1,53 @@ | |||
| 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 | #include "precomp.h" | ||
| 4 | |||
| 5 | int __cdecl wmain(int argc, LPWSTR argv[]) | ||
| 6 | { | ||
| 7 | HRESULT hr = S_OK; | ||
| 8 | BOOL fComInitialized = FALSE; | ||
| 9 | BOOL fShowUsage = FALSE; | ||
| 10 | |||
| 11 | // initialize COM | ||
| 12 | hr = ::CoInitializeEx(NULL, COINIT_MULTITHREADED); | ||
| 13 | ExitOnFailure(hr, "Failed to initialize COM."); | ||
| 14 | fComInitialized = TRUE; | ||
| 15 | |||
| 16 | ConsoleInitialize(); | ||
| 17 | |||
| 18 | if (argc != 4) | ||
| 19 | { | ||
| 20 | fShowUsage = TRUE; | ||
| 21 | } | ||
| 22 | else if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, argv[1], -1, L"reload", -1)) | ||
| 23 | { | ||
| 24 | hr = RunReloadEngine(argv[2], argv[3]); | ||
| 25 | } | ||
| 26 | else if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, argv[1], -1, L"shutdown", -1)) | ||
| 27 | { | ||
| 28 | hr = RunShutdownEngine(argv[2], argv[3]); | ||
| 29 | } | ||
| 30 | else if (CSTR_EQUAL == ::CompareString(LOCALE_INVARIANT, NORM_IGNORECASE, argv[1], -1, L"waitforquit", -1)) | ||
| 31 | { | ||
| 32 | hr = RunWaitForQuitEngine(argv[2], argv[3]); | ||
| 33 | } | ||
| 34 | else | ||
| 35 | { | ||
| 36 | fShowUsage = TRUE; | ||
| 37 | } | ||
| 38 | |||
| 39 | if (fShowUsage) | ||
| 40 | { | ||
| 41 | ConsoleWriteError(hr = E_INVALIDARG, CONSOLE_COLOR_RED, "Usage: Example.TestEngine.exe {reload|shutdown|waitforquit} Bundle.exe BA.dll"); | ||
| 42 | } | ||
| 43 | |||
| 44 | ConsoleUninitialize(); | ||
| 45 | |||
| 46 | LExit: | ||
| 47 | if (fComInitialized) | ||
| 48 | { | ||
| 49 | ::CoUninitialize(); | ||
| 50 | } | ||
| 51 | |||
| 52 | return hr; | ||
| 53 | } | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/ReloadEngine.cpp b/src/ext/Bal/test/examples/TestEngine/ReloadEngine.cpp new file mode 100644 index 00000000..46fd9afa --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/ReloadEngine.cpp | |||
| @@ -0,0 +1,55 @@ | |||
| 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 | #include "precomp.h" | ||
| 4 | |||
| 5 | HRESULT RunReloadEngine( | ||
| 6 | __in LPCWSTR wzBundleFilePath, | ||
| 7 | __in LPCWSTR wzBAFilePath | ||
| 8 | ) | ||
| 9 | { | ||
| 10 | HRESULT hr = S_OK; | ||
| 11 | TestEngine* pTestEngine = NULL; | ||
| 12 | |||
| 13 | pTestEngine = new TestEngine(); | ||
| 14 | ConsoleExitOnNull(pTestEngine, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to create new test engine."); | ||
| 15 | |||
| 16 | hr = pTestEngine->Initialize(wzBundleFilePath); | ||
| 17 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to initialize engine."); | ||
| 18 | |||
| 19 | hr = pTestEngine->LoadBA(wzBAFilePath); | ||
| 20 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA."); | ||
| 21 | |||
| 22 | hr = pTestEngine->SendStartupEvent(); | ||
| 23 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnStartup."); | ||
| 24 | |||
| 25 | hr = pTestEngine->SimulateQuit(0); | ||
| 26 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to simulate quit."); | ||
| 27 | |||
| 28 | hr = pTestEngine->RunApplication(); | ||
| 29 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to run engine."); | ||
| 30 | |||
| 31 | hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER); | ||
| 32 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown."); | ||
| 33 | |||
| 34 | pTestEngine->UnloadBA(); | ||
| 35 | |||
| 36 | hr = pTestEngine->LoadBA(wzBAFilePath); | ||
| 37 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA."); | ||
| 38 | |||
| 39 | hr = pTestEngine->SendStartupEvent(); | ||
| 40 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnStartup."); | ||
| 41 | |||
| 42 | hr = pTestEngine->SimulateQuit(0); | ||
| 43 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to simulate quit."); | ||
| 44 | |||
| 45 | hr = pTestEngine->RunApplication(); | ||
| 46 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to run engine."); | ||
| 47 | |||
| 48 | hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RESTART); | ||
| 49 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown."); | ||
| 50 | |||
| 51 | pTestEngine->UnloadBA(); | ||
| 52 | |||
| 53 | LExit: | ||
| 54 | return hr; | ||
| 55 | } | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/ReloadEngine.h b/src/ext/Bal/test/examples/TestEngine/ReloadEngine.h new file mode 100644 index 00000000..0e8456af --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/ReloadEngine.h | |||
| @@ -0,0 +1,8 @@ | |||
| 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. | ||
| 3 | |||
| 4 | |||
| 5 | HRESULT RunReloadEngine( | ||
| 6 | __in LPCWSTR wzBundleFilePath, | ||
| 7 | __in LPCWSTR wzBAFilePath | ||
| 8 | ); | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.cpp b/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.cpp new file mode 100644 index 00000000..3b876e4e --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.cpp | |||
| @@ -0,0 +1,38 @@ | |||
| 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 | #include "precomp.h" | ||
| 4 | |||
| 5 | HRESULT RunShutdownEngine( | ||
| 6 | __in LPCWSTR wzBundleFilePath, | ||
| 7 | __in LPCWSTR wzBAFilePath | ||
| 8 | ) | ||
| 9 | { | ||
| 10 | HRESULT hr = S_OK; | ||
| 11 | TestEngine* pTestEngine = NULL; | ||
| 12 | |||
| 13 | pTestEngine = new TestEngine(); | ||
| 14 | ConsoleExitOnNull(pTestEngine, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to create new test engine."); | ||
| 15 | |||
| 16 | hr = pTestEngine->Initialize(wzBundleFilePath); | ||
| 17 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to initialize engine."); | ||
| 18 | |||
| 19 | hr = pTestEngine->LoadBA(wzBAFilePath); | ||
| 20 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA."); | ||
| 21 | |||
| 22 | hr = pTestEngine->SendStartupEvent(); | ||
| 23 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnStartup."); | ||
| 24 | |||
| 25 | hr = pTestEngine->SimulateQuit(0); | ||
| 26 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to simulate quit."); | ||
| 27 | |||
| 28 | hr = pTestEngine->RunApplication(); | ||
| 29 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to run engine."); | ||
| 30 | |||
| 31 | hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER); | ||
| 32 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown."); | ||
| 33 | |||
| 34 | pTestEngine->UnloadBA(); | ||
| 35 | |||
| 36 | LExit: | ||
| 37 | return hr; | ||
| 38 | } | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.h b/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.h new file mode 100644 index 00000000..0cfa147a --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/ShutdownEngine.h | |||
| @@ -0,0 +1,8 @@ | |||
| 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. | ||
| 3 | |||
| 4 | |||
| 5 | HRESULT RunShutdownEngine( | ||
| 6 | __in LPCWSTR wzBundleFilePath, | ||
| 7 | __in LPCWSTR wzBAFilePath | ||
| 8 | ); | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp b/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp new file mode 100644 index 00000000..4c7ec1c3 --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/TestEngine.cpp | |||
| @@ -0,0 +1,256 @@ | |||
| 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 | #include "precomp.h" | ||
| 4 | |||
| 5 | HRESULT TestEngine::Initialize( | ||
| 6 | __in LPCWSTR wzBundleFilePath | ||
| 7 | ) | ||
| 8 | { | ||
| 9 | HRESULT hr = S_OK; | ||
| 10 | MSG msg = { }; | ||
| 11 | |||
| 12 | LogInitialize(::GetModuleHandleW(NULL)); | ||
| 13 | |||
| 14 | hr = LogOpen(NULL, PathFile(wzBundleFilePath), NULL, L"txt", FALSE, FALSE, NULL); | ||
| 15 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to open log."); | ||
| 16 | |||
| 17 | ::PeekMessageW(&msg, NULL, WM_USER, WM_USER, PM_NOREMOVE); | ||
| 18 | |||
| 19 | LExit: | ||
| 20 | return hr; | ||
| 21 | } | ||
| 22 | |||
| 23 | HRESULT TestEngine::LoadBA( | ||
| 24 | __in LPCWSTR wzBAFilePath | ||
| 25 | ) | ||
| 26 | { | ||
| 27 | HRESULT hr = S_OK; | ||
| 28 | BOOTSTRAPPER_COMMAND command = { }; | ||
| 29 | BOOTSTRAPPER_CREATE_ARGS args = { }; | ||
| 30 | PFN_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = NULL; | ||
| 31 | |||
| 32 | if (m_pCreateResults || m_hBAModule) | ||
| 33 | { | ||
| 34 | ExitFunction1(hr = E_INVALIDSTATE); | ||
| 35 | } | ||
| 36 | |||
| 37 | m_pCreateResults = static_cast<BOOTSTRAPPER_CREATE_RESULTS*>(MemAlloc(sizeof(BOOTSTRAPPER_CREATE_RESULTS), TRUE)); | ||
| 38 | |||
| 39 | command.cbSize = sizeof(BOOTSTRAPPER_COMMAND); | ||
| 40 | |||
| 41 | hr = PathGetDirectory(wzBAFilePath, &command.wzBootstrapperWorkingFolder); | ||
| 42 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to allocate wzBootstrapperWorkingFolder"); | ||
| 43 | |||
| 44 | hr = PathConcat(command.wzBootstrapperWorkingFolder, L"BootstrapperApplicationData.xml", &command.wzBootstrapperApplicationDataPath); | ||
| 45 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to allocate wzBootstrapperApplicationDataPath"); | ||
| 46 | |||
| 47 | args.cbSize = sizeof(BOOTSTRAPPER_CREATE_ARGS); | ||
| 48 | args.pCommand = &command; | ||
| 49 | args.pfnBootstrapperEngineProc = TestEngine::EngineProc; | ||
| 50 | args.pvBootstrapperEngineProcContext = this; | ||
| 51 | args.qwEngineAPIVersion = MAKEQWORDVERSION(0, 0, 0, 1); | ||
| 52 | |||
| 53 | m_pCreateResults->cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS); | ||
| 54 | |||
| 55 | m_hBAModule = ::LoadLibraryExW(wzBAFilePath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); | ||
| 56 | ConsoleExitOnNullWithLastError(m_hBAModule, hr, CONSOLE_COLOR_RED, "Failed to load BA dll."); | ||
| 57 | |||
| 58 | pfnCreate = (PFN_BOOTSTRAPPER_APPLICATION_CREATE)::GetProcAddress(m_hBAModule, "BootstrapperApplicationCreate"); | ||
| 59 | ConsoleExitOnNull(pfnCreate, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to get address for BootstrapperApplicationCreate."); | ||
| 60 | |||
| 61 | hr = pfnCreate(&args, m_pCreateResults); | ||
| 62 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure on BootstrapperApplicationCreate."); | ||
| 63 | |||
| 64 | LExit: | ||
| 65 | ReleaseStr(command.wzBootstrapperApplicationDataPath); | ||
| 66 | ReleaseStr(command.wzBootstrapperWorkingFolder); | ||
| 67 | |||
| 68 | return hr; | ||
| 69 | } | ||
| 70 | |||
| 71 | HRESULT TestEngine::Log( | ||
| 72 | __in BOOTSTRAPPER_LOG_LEVEL level, | ||
| 73 | __in LPCWSTR wzMessage | ||
| 74 | ) | ||
| 75 | { | ||
| 76 | switch (level) | ||
| 77 | { | ||
| 78 | case BOOTSTRAPPER_LOG_LEVEL_NONE: | ||
| 79 | case BOOTSTRAPPER_LOG_LEVEL_DEBUG: | ||
| 80 | return S_OK; | ||
| 81 | default: | ||
| 82 | LogStringLine(REPORT_STANDARD, "%ls", wzMessage); | ||
| 83 | return ConsoleWriteLine(CONSOLE_COLOR_NORMAL, "%ls", wzMessage); | ||
| 84 | } | ||
| 85 | } | ||
| 86 | |||
| 87 | HRESULT TestEngine::RunApplication() | ||
| 88 | { | ||
| 89 | HRESULT hr = S_OK; | ||
| 90 | MSG msg = { }; | ||
| 91 | BOOL fRet = FALSE; | ||
| 92 | |||
| 93 | // Enter the message pump. | ||
| 94 | while (0 != (fRet = ::GetMessageW(&msg, NULL, 0, 0))) | ||
| 95 | { | ||
| 96 | if (-1 == fRet) | ||
| 97 | { | ||
| 98 | ConsoleExitOnFailure(hr = E_UNEXPECTED, CONSOLE_COLOR_RED, "Unexpected return value from message pump."); | ||
| 99 | } | ||
| 100 | else | ||
| 101 | { | ||
| 102 | ProcessBAMessage(&msg); | ||
| 103 | } | ||
| 104 | } | ||
| 105 | |||
| 106 | LExit: | ||
| 107 | return hr; | ||
| 108 | } | ||
| 109 | |||
| 110 | HRESULT TestEngine::SendShutdownEvent( | ||
| 111 | __in BOOTSTRAPPER_SHUTDOWN_ACTION defaultAction | ||
| 112 | ) | ||
| 113 | { | ||
| 114 | HRESULT hr = S_OK; | ||
| 115 | BA_ONSHUTDOWN_ARGS shutdownArgs = { }; | ||
| 116 | BA_ONSHUTDOWN_RESULTS shutdownResults = { }; | ||
| 117 | shutdownArgs.cbSize = sizeof(BA_ONSHUTDOWN_ARGS); | ||
| 118 | shutdownResults.action = defaultAction; | ||
| 119 | shutdownResults.cbSize = sizeof(BA_ONSHUTDOWN_RESULTS); | ||
| 120 | hr = m_pCreateResults->pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, &shutdownArgs, &shutdownResults, m_pCreateResults->pvBootstrapperApplicationProcContext); | ||
| 121 | return hr; | ||
| 122 | } | ||
| 123 | |||
| 124 | HRESULT TestEngine::SendStartupEvent() | ||
| 125 | { | ||
| 126 | HRESULT hr = S_OK; | ||
| 127 | BA_ONSTARTUP_ARGS startupArgs = { }; | ||
| 128 | BA_ONSTARTUP_RESULTS startupResults = { }; | ||
| 129 | startupArgs.cbSize = sizeof(BA_ONSTARTUP_ARGS); | ||
| 130 | startupResults.cbSize = sizeof(BA_ONSTARTUP_RESULTS); | ||
| 131 | hr = m_pCreateResults->pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSTARTUP, &startupArgs, &startupResults, m_pCreateResults->pvBootstrapperApplicationProcContext); | ||
| 132 | return hr; | ||
| 133 | } | ||
| 134 | |||
| 135 | HRESULT TestEngine::SimulateQuit( | ||
| 136 | __in DWORD dwExitCode | ||
| 137 | ) | ||
| 138 | { | ||
| 139 | BAENGINE_QUIT_ARGS args = { }; | ||
| 140 | BAENGINE_QUIT_RESULTS results = { }; | ||
| 141 | |||
| 142 | args.cbSize = sizeof(BAENGINE_QUIT_ARGS); | ||
| 143 | args.dwExitCode = dwExitCode; | ||
| 144 | |||
| 145 | results.cbSize = sizeof(BAENGINE_QUIT_RESULTS); | ||
| 146 | |||
| 147 | return BAEngineQuit(&args, &results); | ||
| 148 | } | ||
| 149 | |||
| 150 | void TestEngine::UnloadBA() | ||
| 151 | { | ||
| 152 | PFN_BOOTSTRAPPER_APPLICATION_DESTROY pfnDestroy = NULL; | ||
| 153 | BOOL fDisableUnloading = m_pCreateResults && m_pCreateResults->fDisableUnloading; | ||
| 154 | |||
| 155 | ReleaseNullMem(m_pCreateResults); | ||
| 156 | |||
| 157 | pfnDestroy = (PFN_BOOTSTRAPPER_APPLICATION_DESTROY)::GetProcAddress(m_hBAModule, "BootstrapperApplicationDestroy"); | ||
| 158 | |||
| 159 | if (pfnDestroy) | ||
| 160 | { | ||
| 161 | pfnDestroy(); | ||
| 162 | } | ||
| 163 | |||
| 164 | if (m_hBAModule) | ||
| 165 | { | ||
| 166 | if (!fDisableUnloading) | ||
| 167 | { | ||
| 168 | ::FreeLibrary(m_hBAModule); | ||
| 169 | } | ||
| 170 | |||
| 171 | m_hBAModule = NULL; | ||
| 172 | } | ||
| 173 | } | ||
| 174 | |||
| 175 | HRESULT TestEngine::BAEngineLog( | ||
| 176 | __in BAENGINE_LOG_ARGS* pArgs, | ||
| 177 | __in BAENGINE_LOG_RESULTS* /*pResults*/ | ||
| 178 | ) | ||
| 179 | { | ||
| 180 | return Log(pArgs->level, pArgs->wzMessage); | ||
| 181 | } | ||
| 182 | |||
| 183 | HRESULT TestEngine::BAEngineQuit( | ||
| 184 | __in BAENGINE_QUIT_ARGS* pArgs, | ||
| 185 | __in BAENGINE_QUIT_RESULTS* /*pResults*/ | ||
| 186 | ) | ||
| 187 | { | ||
| 188 | HRESULT hr = S_OK; | ||
| 189 | |||
| 190 | if (!::PostThreadMessageW(m_dwThreadId, WM_TESTENG_QUIT, static_cast<WPARAM>(pArgs->dwExitCode), 0)) | ||
| 191 | { | ||
| 192 | ConsoleExitWithLastError(hr, CONSOLE_COLOR_RED, "Failed to post shutdown message."); | ||
| 193 | } | ||
| 194 | |||
| 195 | LExit: | ||
| 196 | return hr; | ||
| 197 | } | ||
| 198 | |||
| 199 | HRESULT WINAPI TestEngine::EngineProc( | ||
| 200 | __in BOOTSTRAPPER_ENGINE_MESSAGE message, | ||
| 201 | __in const LPVOID pvArgs, | ||
| 202 | __inout LPVOID pvResults, | ||
| 203 | __in_opt LPVOID pvContext | ||
| 204 | ) | ||
| 205 | { | ||
| 206 | HRESULT hr = S_OK; | ||
| 207 | TestEngine* pContext = (TestEngine*)pvContext; | ||
| 208 | |||
| 209 | if (!pContext || !pvArgs || !pvResults) | ||
| 210 | { | ||
| 211 | ExitFunction1(hr = E_INVALIDARG); | ||
| 212 | } | ||
| 213 | |||
| 214 | switch (message) | ||
| 215 | { | ||
| 216 | case BOOTSTRAPPER_ENGINE_MESSAGE_LOG: | ||
| 217 | hr = pContext->BAEngineLog(reinterpret_cast<BAENGINE_LOG_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_LOG_RESULTS*>(pvResults)); | ||
| 218 | break; | ||
| 219 | case BOOTSTRAPPER_ENGINE_MESSAGE_QUIT: | ||
| 220 | hr = pContext->BAEngineQuit(reinterpret_cast<BAENGINE_QUIT_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_QUIT_RESULTS*>(pvResults)); | ||
| 221 | default: | ||
| 222 | hr = E_NOTIMPL; | ||
| 223 | break; | ||
| 224 | } | ||
| 225 | |||
| 226 | LExit: | ||
| 227 | return hr; | ||
| 228 | } | ||
| 229 | |||
| 230 | HRESULT TestEngine::ProcessBAMessage( | ||
| 231 | __in const MSG* pmsg | ||
| 232 | ) | ||
| 233 | { | ||
| 234 | HRESULT hr = S_OK; | ||
| 235 | |||
| 236 | switch (pmsg->message) | ||
| 237 | { | ||
| 238 | case WM_TESTENG_QUIT: | ||
| 239 | ::PostQuitMessage(static_cast<int>(pmsg->wParam)); // go bye-bye. | ||
| 240 | break; | ||
| 241 | } | ||
| 242 | |||
| 243 | return hr; | ||
| 244 | } | ||
| 245 | |||
| 246 | TestEngine::TestEngine() | ||
| 247 | { | ||
| 248 | m_hBAModule = NULL; | ||
| 249 | m_pCreateResults = NULL; | ||
| 250 | m_dwThreadId = ::GetCurrentThreadId(); | ||
| 251 | } | ||
| 252 | |||
| 253 | TestEngine::~TestEngine() | ||
| 254 | { | ||
| 255 | ReleaseMem(m_pCreateResults); | ||
| 256 | } | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/TestEngine.h b/src/ext/Bal/test/examples/TestEngine/TestEngine.h new file mode 100644 index 00000000..44e813bd --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/TestEngine.h | |||
| @@ -0,0 +1,80 @@ | |||
| 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. | ||
| 3 | |||
| 4 | |||
| 5 | enum WM_TESTENG | ||
| 6 | { | ||
| 7 | WM_TESTENG_FIRST = WM_APP + 0xFFF, // this enum value must always be first. | ||
| 8 | |||
| 9 | WM_TESTENG_DETECT, | ||
| 10 | WM_TESTENG_PLAN, | ||
| 11 | WM_TESTENG_ELEVATE, | ||
| 12 | WM_TESTENG_APPLY, | ||
| 13 | WM_TESTENG_LAUNCH_APPROVED_EXE, | ||
| 14 | WM_TESTENG_QUIT, | ||
| 15 | |||
| 16 | WM_TESTENG_LAST, // this enum value must always be last. | ||
| 17 | }; | ||
| 18 | |||
| 19 | class TestEngine | ||
| 20 | { | ||
| 21 | public: | ||
| 22 | HRESULT Initialize( | ||
| 23 | __in LPCWSTR wzBundleFilePath | ||
| 24 | ); | ||
| 25 | |||
| 26 | HRESULT LoadBA( | ||
| 27 | __in LPCWSTR wzBAFilePath | ||
| 28 | ); | ||
| 29 | |||
| 30 | HRESULT Log( | ||
| 31 | __in BOOTSTRAPPER_LOG_LEVEL level, | ||
| 32 | __in LPCWSTR wzMessage | ||
| 33 | ); | ||
| 34 | |||
| 35 | HRESULT RunApplication(); | ||
| 36 | |||
| 37 | HRESULT SendShutdownEvent( | ||
| 38 | __in BOOTSTRAPPER_SHUTDOWN_ACTION defaultAction | ||
| 39 | ); | ||
| 40 | |||
| 41 | HRESULT SendStartupEvent(); | ||
| 42 | |||
| 43 | HRESULT SimulateQuit( | ||
| 44 | __in DWORD dwExitCode | ||
| 45 | ); | ||
| 46 | |||
| 47 | void UnloadBA(); | ||
| 48 | |||
| 49 | private: | ||
| 50 | HRESULT BAEngineLog( | ||
| 51 | __in BAENGINE_LOG_ARGS* pArgs, | ||
| 52 | __in BAENGINE_LOG_RESULTS* pResults | ||
| 53 | ); | ||
| 54 | |||
| 55 | HRESULT BAEngineQuit( | ||
| 56 | __in BAENGINE_QUIT_ARGS* pArgs, | ||
| 57 | __in BAENGINE_QUIT_RESULTS* pResults | ||
| 58 | ); | ||
| 59 | |||
| 60 | static HRESULT WINAPI EngineProc( | ||
| 61 | __in BOOTSTRAPPER_ENGINE_MESSAGE message, | ||
| 62 | __in const LPVOID pvArgs, | ||
| 63 | __inout LPVOID pvResults, | ||
| 64 | __in_opt LPVOID pvContext | ||
| 65 | ); | ||
| 66 | |||
| 67 | HRESULT ProcessBAMessage( | ||
| 68 | __in const MSG* pmsg | ||
| 69 | ); | ||
| 70 | |||
| 71 | public: | ||
| 72 | TestEngine(); | ||
| 73 | |||
| 74 | ~TestEngine(); | ||
| 75 | |||
| 76 | private: | ||
| 77 | HMODULE m_hBAModule; | ||
| 78 | BOOTSTRAPPER_CREATE_RESULTS* m_pCreateResults; | ||
| 79 | DWORD m_dwThreadId; | ||
| 80 | }; \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.cpp b/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.cpp new file mode 100644 index 00000000..2f80ba75 --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.cpp | |||
| @@ -0,0 +1,35 @@ | |||
| 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 | #include "precomp.h" | ||
| 4 | |||
| 5 | HRESULT RunWaitForQuitEngine( | ||
| 6 | __in LPCWSTR wzBundleFilePath, | ||
| 7 | __in LPCWSTR wzBAFilePath | ||
| 8 | ) | ||
| 9 | { | ||
| 10 | HRESULT hr = S_OK; | ||
| 11 | TestEngine* pTestEngine = NULL; | ||
| 12 | |||
| 13 | pTestEngine = new TestEngine(); | ||
| 14 | ConsoleExitOnNull(pTestEngine, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to create new test engine."); | ||
| 15 | |||
| 16 | hr = pTestEngine->Initialize(wzBundleFilePath); | ||
| 17 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to initialize engine."); | ||
| 18 | |||
| 19 | hr = pTestEngine->LoadBA(wzBAFilePath); | ||
| 20 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA."); | ||
| 21 | |||
| 22 | hr = pTestEngine->SendStartupEvent(); | ||
| 23 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnStartup."); | ||
| 24 | |||
| 25 | hr = pTestEngine->RunApplication(); | ||
| 26 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to run engine."); | ||
| 27 | |||
| 28 | hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER); | ||
| 29 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown."); | ||
| 30 | |||
| 31 | pTestEngine->UnloadBA(); | ||
| 32 | |||
| 33 | LExit: | ||
| 34 | return hr; | ||
| 35 | } | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.h b/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.h new file mode 100644 index 00000000..99e3f63c --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/WaitForQuitEngine.h | |||
| @@ -0,0 +1,8 @@ | |||
| 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. | ||
| 3 | |||
| 4 | |||
| 5 | HRESULT RunWaitForQuitEngine( | ||
| 6 | __in LPCWSTR wzBundleFilePath, | ||
| 7 | __in LPCWSTR wzBAFilePath | ||
| 8 | ); | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/packages.config b/src/ext/Bal/test/examples/TestEngine/packages.config new file mode 100644 index 00000000..548ddb48 --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/packages.config | |||
| @@ -0,0 +1,7 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <packages> | ||
| 3 | <package id="Nerdbank.GitVersioning" version="3.3.37" targetFramework="native" developmentDependency="true" /> | ||
| 4 | <package id="WixToolset.BootstrapperCore.Native" version="4.0.141" targetFramework="native" /> | ||
| 5 | <package id="WixToolset.BalUtil" version="4.0.58" targetFramework="native" /> | ||
| 6 | <package id="WixToolset.DUtil" version="4.0.72" targetFramework="native" /> | ||
| 7 | </packages> \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/precomp.cpp b/src/ext/Bal/test/examples/TestEngine/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/precomp.cpp | |||
| @@ -0,0 +1,3 @@ | |||
| 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 | #include "precomp.h" | ||
diff --git a/src/ext/Bal/test/examples/TestEngine/precomp.h b/src/ext/Bal/test/examples/TestEngine/precomp.h new file mode 100644 index 00000000..f943f420 --- /dev/null +++ b/src/ext/Bal/test/examples/TestEngine/precomp.h | |||
| @@ -0,0 +1,20 @@ | |||
| 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. | ||
| 3 | |||
| 4 | #include <windows.h> | ||
| 5 | #include <MsiQuery.h> | ||
| 6 | |||
| 7 | #include "dutil.h" | ||
| 8 | #include "conutil.h" | ||
| 9 | #include "logutil.h" | ||
| 10 | #include "memutil.h" | ||
| 11 | #include "pathutil.h" | ||
| 12 | #include "strutil.h" | ||
| 13 | |||
| 14 | #include "BootstrapperEngine.h" | ||
| 15 | #include "BootstrapperApplication.h" | ||
| 16 | |||
| 17 | #include "TestEngine.h" | ||
| 18 | #include "ReloadEngine.h" | ||
| 19 | #include "ShutdownEngine.h" | ||
| 20 | #include "WaitForQuitEngine.h" | ||
diff --git a/src/ext/Bal/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs b/src/ext/Bal/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs new file mode 100644 index 00000000..68d742b0 --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreBundleFDD/FrameworkDependentBundle.wxs | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
| 2 | <Bundle Name="FDDWPFCoreMBA" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="5CE5B5C7-4B6B-4B95-B297-731F1F956533"> | ||
| 3 | <BootstrapperApplication> | ||
| 4 | <Payload SourceFile="publish\Example.WPFCoreMBA\fdd\Example.WPFCoreMBA.deps.json" Name="Example.WPFCoreMBA.deps.json" /> | ||
| 5 | <Payload SourceFile="publish\Example.WPFCoreMBA\fdd\Example.WPFCoreMBA.dll" Name="Example.WPFCoreMBA.dll" bal:BAFactoryAssembly="yes" /> | ||
| 6 | <Payload SourceFile="publish\Example.WPFCoreMBA\fdd\Example.WPFCoreMBA.pdb" Name="Example.WPFCoreMBA.pdb" /> | ||
| 7 | <Payload SourceFile="publish\Example.WPFCoreMBA\fdd\Example.WPFCoreMBA.runtimeconfig.json" Name="Example.WPFCoreMBA.runtimeconfig.json" /> | ||
| 8 | <Payload SourceFile="publish\Example.WPFCoreMBA\fdd\mbanative.dll" Name="mbanative.dll" /> | ||
| 9 | <Payload SourceFile="publish\Example.WPFCoreMBA\fdd\WixToolset.Mba.Core.dll" Name="WixToolset.Mba.Core.dll" /> | ||
| 10 | <bal:WixDotNetCoreBootstrapperApplicationHost /> | ||
| 11 | </BootstrapperApplication> | ||
| 12 | <Chain> | ||
| 13 | <ExePackage DetectCondition="none" SourceFile="c:\windows\system32\kernel32.dll" bal:PrereqPackage="yes" /> | ||
| 14 | </Chain> | ||
| 15 | </Bundle> | ||
| 16 | </Wix> | ||
diff --git a/src/ext/Bal/test/examples/WPFCoreBundleFDD/WPFCoreBundleFDD.wixproj b/src/ext/Bal/test/examples/WPFCoreBundleFDD/WPFCoreBundleFDD.wixproj new file mode 100644 index 00000000..ba75a9ff --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreBundleFDD/WPFCoreBundleFDD.wixproj | |||
| @@ -0,0 +1,2 @@ | |||
| 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 | <Project Sdk="WixToolset.Sdk" /> | ||
diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/AssemblyInfo.cs b/src/ext/Bal/test/examples/WPFCoreMBA/AssemblyInfo.cs new file mode 100644 index 00000000..03a5c7fa --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/AssemblyInfo.cs | |||
| @@ -0,0 +1,12 @@ | |||
| 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 | using System.Windows; | ||
| 4 | |||
| 5 | [assembly:ThemeInfo( | ||
| 6 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | ||
| 7 | //(used if a resource is not found in the page, | ||
| 8 | // or application resource dictionaries) | ||
| 9 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | ||
| 10 | //(used if a resource is not found in the page, | ||
| 11 | // app, or any theme specific resource dictionaries) | ||
| 12 | )] | ||
diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj b/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj new file mode 100644 index 00000000..296e5be9 --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/Example.WPFCoreMBA.csproj | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | <Project Sdk="Microsoft.NET.Sdk"> | ||
| 2 | |||
| 3 | <PropertyGroup> | ||
| 4 | <TargetFramework>net5.0-windows</TargetFramework> | ||
| 5 | <RuntimeIdentifiers>win-x86;win-x64</RuntimeIdentifiers> | ||
| 6 | <EnableDynamicLoading>true</EnableDynamicLoading> | ||
| 7 | <Description>WPF .NET Core MBA</Description> | ||
| 8 | <UseWPF>true</UseWPF> | ||
| 9 | </PropertyGroup> | ||
| 10 | |||
| 11 | |||
| 12 | <ItemGroup> | ||
| 13 | <PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" /> | ||
| 14 | <PackageReference Include="WixToolset.Mba.Core" Version="4.0.*" /> | ||
| 15 | </ItemGroup> | ||
| 16 | </Project> \ No newline at end of file | ||
diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml b/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml new file mode 100644 index 00000000..40a27a06 --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml | |||
| @@ -0,0 +1,16 @@ | |||
| 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 | |||
| 5 | <Window x:Class="Example.WPFCoreMBA.MainWindow" | ||
| 6 | xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
| 7 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
| 8 | xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
| 9 | xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
| 10 | xmlns:local="clr-namespace:Example.WPFCoreMBA" | ||
| 11 | mc:Ignorable="d" | ||
| 12 | Title="MainWindow" Height="450" Width="800"> | ||
| 13 | <Grid> | ||
| 14 | |||
| 15 | </Grid> | ||
| 16 | </Window> | ||
diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml.cs b/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml.cs new file mode 100644 index 00000000..4f61b807 --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/MainWindow.xaml.cs | |||
| @@ -0,0 +1,17 @@ | |||
| 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 Example.WPFCoreMBA | ||
| 4 | { | ||
| 5 | using System.Windows; | ||
| 6 | |||
| 7 | /// <summary> | ||
| 8 | /// Interaction logic for MainWindow.xaml | ||
| 9 | /// </summary> | ||
| 10 | public partial class MainWindow : Window | ||
| 11 | { | ||
| 12 | public MainWindow() | ||
| 13 | { | ||
| 14 | this.InitializeComponent(); | ||
| 15 | } | ||
| 16 | } | ||
| 17 | } | ||
diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBA.cs b/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBA.cs new file mode 100644 index 00000000..d50be813 --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBA.cs | |||
| @@ -0,0 +1,42 @@ | |||
| 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 Example.WPFCoreMBA | ||
| 4 | { | ||
| 5 | using System.Windows.Threading; | ||
| 6 | using WixToolset.Mba.Core; | ||
| 7 | |||
| 8 | public class WPFCoreBA : BootstrapperApplication | ||
| 9 | { | ||
| 10 | public WPFCoreBA(IEngine engine) | ||
| 11 | : base(engine) | ||
| 12 | { | ||
| 13 | } | ||
| 14 | |||
| 15 | public Dispatcher BADispatcher { get; private set; } | ||
| 16 | |||
| 17 | protected override void Run() | ||
| 18 | { | ||
| 19 | this.BADispatcher = Dispatcher.CurrentDispatcher; | ||
| 20 | var window = new MainWindow(); | ||
| 21 | window.Closed += (s, e) => this.BADispatcher.InvokeShutdown(); | ||
| 22 | //window.Show(); | ||
| 23 | //Dispatcher.Run(); | ||
| 24 | //this.engine.Quit(0); | ||
| 25 | } | ||
| 26 | |||
| 27 | protected override void OnStartup(StartupEventArgs args) | ||
| 28 | { | ||
| 29 | base.OnStartup(args); | ||
| 30 | |||
| 31 | this.engine.Log(LogLevel.Standard, nameof(WPFCoreBA)); | ||
| 32 | } | ||
| 33 | |||
| 34 | protected override void OnShutdown(ShutdownEventArgs args) | ||
| 35 | { | ||
| 36 | base.OnShutdown(args); | ||
| 37 | |||
| 38 | var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); | ||
| 39 | this.engine.Log(LogLevel.Standard, message); | ||
| 40 | } | ||
| 41 | } | ||
| 42 | } | ||
diff --git a/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBAFactory.cs b/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBAFactory.cs new file mode 100644 index 00000000..a3ccdf9f --- /dev/null +++ b/src/ext/Bal/test/examples/WPFCoreMBA/WPFCoreBAFactory.cs | |||
| @@ -0,0 +1,22 @@ | |||
| 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 | [assembly: WixToolset.Mba.Core.BootstrapperApplicationFactory(typeof(Example.WPFCoreMBA.WPFCoreBAFactory))] | ||
| 4 | namespace Example.WPFCoreMBA | ||
| 5 | { | ||
| 6 | using WixToolset.Mba.Core; | ||
| 7 | |||
| 8 | public class WPFCoreBAFactory : BaseBootstrapperApplicationFactory | ||
| 9 | { | ||
| 10 | private static int loadCount = 0; | ||
| 11 | |||
| 12 | protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) | ||
| 13 | { | ||
| 14 | if (loadCount > 0) | ||
| 15 | { | ||
| 16 | engine.Log(LogLevel.Standard, $"Reloaded {loadCount} time(s)"); | ||
| 17 | } | ||
| 18 | ++loadCount; | ||
| 19 | return new WPFCoreBA(engine); | ||
| 20 | } | ||
| 21 | } | ||
| 22 | } | ||
diff --git a/src/ext/Bal/test/examples/Wix.Build.props b/src/ext/Bal/test/examples/Wix.Build.props new file mode 100644 index 00000000..aad94bb6 --- /dev/null +++ b/src/ext/Bal/test/examples/Wix.Build.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 | <Project> | ||
| 4 | <PropertyGroup> | ||
| 5 | <OutputType>Bundle</OutputType> | ||
| 6 | <TargetExt>.exe</TargetExt> | ||
| 7 | <HarvestDirectoryAdditionalOptions>-generate payloadgroup</HarvestDirectoryAdditionalOptions> | ||
| 8 | <OutputPath>$(OutputPath)examples\</OutputPath> | ||
| 9 | </PropertyGroup> | ||
| 10 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/Wix.Build.targets b/src/ext/Bal/test/examples/Wix.Build.targets new file mode 100644 index 00000000..7e6fe9f2 --- /dev/null +++ b/src/ext/Bal/test/examples/Wix.Build.targets | |||
| @@ -0,0 +1,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. --> | ||
| 3 | <Project> | ||
| 4 | <ItemGroup> | ||
| 5 | <BindInputPaths Include="$(OutputPath)" /> | ||
| 6 | <WixExtension Include="$(OutputPath)..\netstandard2.0\WixToolset.Bal.wixext.dll" /> | ||
| 7 | </ItemGroup> | ||
| 8 | </Project> | ||
diff --git a/src/ext/Bal/test/examples/examples.proj b/src/ext/Bal/test/examples/examples.proj new file mode 100644 index 00000000..08cb7511 --- /dev/null +++ b/src/ext/Bal/test/examples/examples.proj | |||
| @@ -0,0 +1,50 @@ | |||
| 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 | |||
| 5 | <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| 6 | <Import Project="..\..\Directory.Build.props" /> | ||
| 7 | |||
| 8 | <PropertyGroup> | ||
| 9 | <EarliestCoreMBAProjectPath>EarliestCoreMBA\Example.EarliestCoreMBA.csproj</EarliestCoreMBAProjectPath> | ||
| 10 | <FullFramework2MBAProjectPath>FullFramework2MBA\Example.FullFramework2MBA.csproj</FullFramework2MBAProjectPath> | ||
| 11 | <FullFramework4MBAProjectPath>FullFramework4MBA\Example.FullFramework4MBA.csproj</FullFramework4MBAProjectPath> | ||
| 12 | <LatestCoreMBAProjectPath>LatestCoreMBA\Example.LatestCoreMBA.csproj</LatestCoreMBAProjectPath> | ||
| 13 | <WPFCoreMBAProjectPath>WPFCoreMBA\Example.WPFCoreMBA.csproj</WPFCoreMBAProjectPath> | ||
| 14 | <MBAPublishPath>$(OutputPath)examples\publish\</MBAPublishPath> | ||
| 15 | </PropertyGroup> | ||
| 16 | |||
| 17 | <ItemGroup> | ||
| 18 | <CoreMBAProject Include="$(EarliestCoreMBAProjectPath)"> | ||
| 19 | <PublishPath>$(MBAPublishPath)Example.EarliestCoreMBA</PublishPath> | ||
| 20 | </CoreMBAProject> | ||
| 21 | <CoreMBAProject Include="$(LatestCoreMBAProjectPath)"> | ||
| 22 | <PublishPath>$(MBAPublishPath)Example.LatestCoreMBA</PublishPath> | ||
| 23 | </CoreMBAProject> | ||
| 24 | <CoreMBAProject Include="$(WPFCoreMBAProjectPath)"> | ||
| 25 | <PublishPath>$(MBAPublishPath)Example.WPFCoreMBA</PublishPath> | ||
| 26 | <SkipSCD>true</SkipSCD> | ||
| 27 | <SkipTrimmedSCD>true</SkipTrimmedSCD> | ||
| 28 | </CoreMBAProject> | ||
| 29 | |||
| 30 | <FullMBAProject Include="$(FullFramework2MBAProjectPath)" /> | ||
| 31 | <FullMBAProject Include="$(FullFramework4MBAProjectPath)" /> | ||
| 32 | |||
| 33 | <ExampleBundleProject Include="**\*.wixproj" /> | ||
| 34 | </ItemGroup> | ||
| 35 | |||
| 36 | <Target Name="PublishCoreExamples"> | ||
| 37 | <Exec Command='dotnet publish -o "%(CoreMBAProject.PublishPath)\fdd" -r win-x86 -c $(Configuration) --self-contained false "%(CoreMBAProject.Identity)"' | ||
| 38 | Condition="'%(CoreMBAProject.SkipFDD)'==''" /> | ||
| 39 | <Exec Command='dotnet publish -o "%(CoreMBAProject.PublishPath)\scd" -r win-x86 -c $(Configuration) --self-contained true "%(CoreMBAProject.Identity)"' | ||
| 40 | 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 | Condition="'%(CoreMBAProject.SkipTrimmedSCD)'==''" /> | ||
| 43 | </Target> | ||
| 44 | |||
| 45 | <Target Name="Build" DependsOnTargets="PublishCoreExamples"> | ||
| 46 | <MSBuild Projects="%(ExampleBundleProject.Identity)" /> | ||
| 47 | </Target> | ||
| 48 | |||
| 49 | <Import Project="..\..\Directory.Build.targets" /> | ||
| 50 | </Project> \ No newline at end of file | ||
