diff options
Diffstat (limited to 'src/test/examples')
20 files changed, 560 insertions, 0 deletions
diff --git a/src/test/examples/FullFramework2MBA/BootstrapperApplicationData.xml b/src/test/examples/FullFramework2MBA/BootstrapperApplicationData.xml new file mode 100644 index 00000000..7c4169b1 --- /dev/null +++ b/src/test/examples/FullFramework2MBA/BootstrapperApplicationData.xml | |||
Binary files differ | |||
diff --git a/src/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj b/src/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj new file mode 100644 index 00000000..dec1ff1e --- /dev/null +++ b/src/test/examples/FullFramework2MBA/Example.FullFramework2MBA.csproj | |||
@@ -0,0 +1,77 @@ | |||
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="..\..\..\..\packages\WixToolset.Mba.Core.4.0.12\build\net20\WixToolset.Mba.Core.props" Condition="Exists('..\..\..\..\packages\WixToolset.Mba.Core.4.0.12\build\net20\WixToolset.Mba.Core.props')" /> | ||
7 | <PropertyGroup> | ||
8 | <ProjectGuid>{CC4236FC-226E-4232-AB50-24CBEC4D314D}</ProjectGuid> | ||
9 | <AssemblyName>Example.FullFramework2MBA</AssemblyName> | ||
10 | <OutputType>Library</OutputType> | ||
11 | <RootNamespace>Example.FullFramework2MBA</RootNamespace> | ||
12 | <TargetFrameworkVersion>v2.0</TargetFrameworkVersion> | ||
13 | <CreateDocumentation>false</CreateDocumentation> | ||
14 | </PropertyGroup> | ||
15 | <PropertyGroup Condition=" '$(Configuration)' == 'Debug' "> | ||
16 | <DebugSymbols>true</DebugSymbols> | ||
17 | <Optimize>false</Optimize> | ||
18 | <DefineConstants>$(DefineConstants);DEBUG;TRACE</DefineConstants> | ||
19 | </PropertyGroup> | ||
20 | <PropertyGroup Condition=" '$(Configuration)' == 'Release' "> | ||
21 | <DebugSymbols>true</DebugSymbols> | ||
22 | <Optimize>true</Optimize> | ||
23 | <DefineConstants>$(DefineConstants);TRACE</DefineConstants> | ||
24 | </PropertyGroup> | ||
25 | <ItemGroup> | ||
26 | <Compile Include="FullFramework2BA.cs" /> | ||
27 | <Compile Include="FullFramework2BAFactory.cs" /> | ||
28 | <Compile Include="Properties\AssemblyInfo.cs" /> | ||
29 | </ItemGroup> | ||
30 | <ItemGroup> | ||
31 | <Content Include="BootstrapperApplicationData.xml" CopyToOutputDirectory="PreserveNewest" /> | ||
32 | <Content Include="WixToolset.Mba.Host.config" CopyToOutputDirectory="PreserveNewest" /> | ||
33 | </ItemGroup> | ||
34 | <ItemGroup> | ||
35 | <None Include="packages.config" /> | ||
36 | </ItemGroup> | ||
37 | <ItemGroup> | ||
38 | <Reference Include="System" /> | ||
39 | <Reference Include="System.Configuration" /> | ||
40 | <Reference Include="System.Data" /> | ||
41 | <Reference Include="System.Xml" /> | ||
42 | <Reference Include="WixToolset.Mba.Core"> | ||
43 | <HintPath>..\..\..\..\packages\WixToolset.Mba.Core.4.0.12\lib\net20\WixToolset.Mba.Core.dll</HintPath> | ||
44 | </Reference> | ||
45 | </ItemGroup> | ||
46 | <ItemGroup> | ||
47 | <ProjectReference Include="..\..\..\mbahost\mbahost.vcxproj"> | ||
48 | <Project>{12c87c77-3547-44f8-8134-29bc915cb19d}</Project> | ||
49 | <ReferenceOutputAssembly>false</ReferenceOutputAssembly> | ||
50 | </ProjectReference> | ||
51 | <ProjectReference Include="..\..\..\WixToolset.Mba.Host\WixToolset.Mba.Host.csproj"> | ||
52 | <Project>{F2BA1935-70FA-4156-B161-FD03850B4FAA}</Project> | ||
53 | <ReferenceOutputAssembly>false</ReferenceOutputAssembly> | ||
54 | <OutputItemType>Content</OutputItemType> | ||
55 | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
56 | </ProjectReference> | ||
57 | </ItemGroup> | ||
58 | |||
59 | <ItemGroup> | ||
60 | <MbaHostDependency Include="$(BaseOutputPath)$(Configuration)\Win32\mbahost.dll" /> | ||
61 | </ItemGroup> | ||
62 | |||
63 | <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
64 | |||
65 | <Import Project="..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" /> | ||
66 | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
67 | <PropertyGroup> | ||
68 | <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> | ||
69 | </PropertyGroup> | ||
70 | <Error Condition="!Exists('..\..\..\..\packages\WixToolset.Mba.Core.4.0.12\build\net20\WixToolset.Mba.Core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.Mba.Core.4.0.12\build\net20\WixToolset.Mba.Core.props'))" /> | ||
71 | <Error Condition="!Exists('..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets'))" /> | ||
72 | </Target> | ||
73 | |||
74 | <Target Name="CopyMbaHostDependencies" AfterTargets="Build"> | ||
75 | <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(MbaHostDependency)" SkipUnchangedFiles="true" /> | ||
76 | </Target> | ||
77 | </Project> \ No newline at end of file | ||
diff --git a/src/test/examples/FullFramework2MBA/FullFramework2BA.cs b/src/test/examples/FullFramework2MBA/FullFramework2BA.cs new file mode 100644 index 00000000..13d4673a --- /dev/null +++ b/src/test/examples/FullFramework2MBA/FullFramework2BA.cs | |||
@@ -0,0 +1,27 @@ | |||
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 OnShutdown(ShutdownEventArgs args) | ||
20 | { | ||
21 | base.OnShutdown(args); | ||
22 | |||
23 | var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); | ||
24 | this.engine.Log(LogLevel.Standard, message); | ||
25 | } | ||
26 | } | ||
27 | } | ||
diff --git a/src/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs b/src/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs new file mode 100644 index 00000000..d3cafc70 --- /dev/null +++ b/src/test/examples/FullFramework2MBA/FullFramework2BAFactory.cs | |||
@@ -0,0 +1,14 @@ | |||
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 FullFramework2BAFactory : BaseBootstrapperApplicationFactory | ||
8 | { | ||
9 | protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) | ||
10 | { | ||
11 | return new FullFramework2BA(engine); | ||
12 | } | ||
13 | } | ||
14 | } | ||
diff --git a/src/test/examples/FullFramework2MBA/Properties/AssemblyInfo.cs b/src/test/examples/FullFramework2MBA/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..640c17ad --- /dev/null +++ b/src/test/examples/FullFramework2MBA/Properties/AssemblyInfo.cs | |||
@@ -0,0 +1,18 @@ | |||
1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
2 | |||
3 | using System; | ||
4 | using System.Reflection; | ||
5 | using System.Runtime.InteropServices; | ||
6 | using WixToolset.Mba.Core; | ||
7 | |||
8 | [assembly: AssemblyTitle("Example.FullFramework2MBA")] | ||
9 | [assembly: AssemblyDescription("Example.FullFramework2MBA")] | ||
10 | [assembly: AssemblyProduct("WiX Toolset")] | ||
11 | [assembly: AssemblyCompany("WiX Toolset Team")] | ||
12 | [assembly: AssemblyCopyright("Copyright (c) .NET Foundation and contributors. All rights reserved.")] | ||
13 | |||
14 | // Types should not be visible to COM by default. | ||
15 | [assembly: ComVisible(false)] | ||
16 | [assembly: Guid("7A671EAF-FAE5-41A2-83DD-C35AB3779651")] | ||
17 | |||
18 | [assembly: BootstrapperApplicationFactory(typeof(Example.FullFramework2MBA.FullFramework2BAFactory))] | ||
diff --git a/src/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config b/src/test/examples/FullFramework2MBA/WixToolset.Mba.Host.config new file mode 100644 index 00000000..be450a4f --- /dev/null +++ b/src/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/test/examples/FullFramework2MBA/packages.config b/src/test/examples/FullFramework2MBA/packages.config new file mode 100644 index 00000000..77b7e398 --- /dev/null +++ b/src/test/examples/FullFramework2MBA/packages.config | |||
@@ -0,0 +1,4 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <packages> | ||
3 | <package id="WixToolset.Mba.Core" version="4.0.12" targetFramework="net461" /> | ||
4 | </packages> \ No newline at end of file | ||
diff --git a/src/test/examples/FullFramework4MBA/BootstrapperApplicationData.xml b/src/test/examples/FullFramework4MBA/BootstrapperApplicationData.xml new file mode 100644 index 00000000..7c4169b1 --- /dev/null +++ b/src/test/examples/FullFramework4MBA/BootstrapperApplicationData.xml | |||
Binary files differ | |||
diff --git a/src/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj b/src/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj new file mode 100644 index 00000000..e044c6b1 --- /dev/null +++ b/src/test/examples/FullFramework4MBA/Example.FullFramework4MBA.csproj | |||
@@ -0,0 +1,38 @@ | |||
1 | <Project Sdk="Microsoft.NET.Sdk"> | ||
2 | |||
3 | <PropertyGroup> | ||
4 | <TargetFramework>net48</TargetFramework> | ||
5 | <Description>Full Framework v4 MBA</Description> | ||
6 | </PropertyGroup> | ||
7 | |||
8 | <ItemGroup> | ||
9 | <PackageReference Include="Nerdbank.GitVersioning" Version="2.1.65" PrivateAssets="all" /> | ||
10 | <PackageReference Include="WixToolset.Mba.Core" Version="4.0.*" PrivateAssets="All" /> | ||
11 | </ItemGroup> | ||
12 | |||
13 | <ItemGroup> | ||
14 | <Content Include="BootstrapperApplicationData.xml" CopyToOutputDirectory="PreserveNewest" /> | ||
15 | <Content Include="WixToolset.Mba.Host.config" CopyToOutputDirectory="PreserveNewest" /> | ||
16 | </ItemGroup> | ||
17 | |||
18 | <ItemGroup> | ||
19 | <ProjectReference Include="..\..\..\mbahost\mbahost.vcxproj"> | ||
20 | <Project>{12c87c77-3547-44f8-8134-29bc915cb19d}</Project> | ||
21 | <ReferenceOutputAssembly>false</ReferenceOutputAssembly> | ||
22 | </ProjectReference> | ||
23 | <ProjectReference Include="..\..\..\WixToolset.Mba.Host\WixToolset.Mba.Host.csproj"> | ||
24 | <Project>{F2BA1935-70FA-4156-B161-FD03850B4FAA}</Project> | ||
25 | <ReferenceOutputAssembly>false</ReferenceOutputAssembly> | ||
26 | <OutputItemType>Content</OutputItemType> | ||
27 | <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
28 | </ProjectReference> | ||
29 | </ItemGroup> | ||
30 | |||
31 | <ItemGroup> | ||
32 | <MbaHostDependency Include="$(BaseOutputPath)$(Configuration)\Win32\mbahost.dll" /> | ||
33 | </ItemGroup> | ||
34 | |||
35 | <Target Name="CopyMbaHostDependencies" AfterTargets="Build"> | ||
36 | <Copy DestinationFolder="$(OutputPath)" SourceFiles="@(MbaHostDependency)" SkipUnchangedFiles="true" /> | ||
37 | </Target> | ||
38 | </Project> \ No newline at end of file | ||
diff --git a/src/test/examples/FullFramework4MBA/FullFramework4BA.cs b/src/test/examples/FullFramework4MBA/FullFramework4BA.cs new file mode 100644 index 00000000..556a61a7 --- /dev/null +++ b/src/test/examples/FullFramework4MBA/FullFramework4BA.cs | |||
@@ -0,0 +1,27 @@ | |||
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 OnShutdown(ShutdownEventArgs args) | ||
20 | { | ||
21 | base.OnShutdown(args); | ||
22 | |||
23 | var message = "Shutdown," + args.Action.ToString() + "," + args.HResult.ToString(); | ||
24 | this.engine.Log(LogLevel.Standard, message); | ||
25 | } | ||
26 | } | ||
27 | } | ||
diff --git a/src/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs b/src/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs new file mode 100644 index 00000000..b7c8750d --- /dev/null +++ b/src/test/examples/FullFramework4MBA/FullFramework4BAFactory.cs | |||
@@ -0,0 +1,15 @@ | |||
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 | protected override IBootstrapperApplication Create(IEngine engine, IBootstrapperCommand bootstrapperCommand) | ||
11 | { | ||
12 | return new FullFramework4BA(engine); | ||
13 | } | ||
14 | } | ||
15 | } | ||
diff --git a/src/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config b/src/test/examples/FullFramework4MBA/WixToolset.Mba.Host.config new file mode 100644 index 00000000..96678cda --- /dev/null +++ b/src/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/test/examples/TestEngine/Example.TestEngine.vcxproj b/src/test/examples/TestEngine/Example.TestEngine.vcxproj new file mode 100644 index 00000000..ab79dacc --- /dev/null +++ b/src/test/examples/TestEngine/Example.TestEngine.vcxproj | |||
@@ -0,0 +1,70 @@ | |||
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.12\build\WixToolset.BalUtil.props" Condition="Exists('..\..\..\..\packages\WixToolset.BalUtil.4.0.12\build\WixToolset.BalUtil.props')" /> | ||
5 | <Import Project="..\..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.10\build\WixToolset.BootstrapperCore.Native.props" Condition="Exists('..\..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.10\build\WixToolset.BootstrapperCore.Native.props')" /> | ||
6 | <Import Project="..\..\..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props" Condition="Exists('..\..\..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" /> | ||
7 | <ItemGroup Label="ProjectConfigurations"> | ||
8 | <ProjectConfiguration Include="Debug|Win32"> | ||
9 | <Configuration>Debug</Configuration> | ||
10 | <Platform>Win32</Platform> | ||
11 | </ProjectConfiguration> | ||
12 | <ProjectConfiguration Include="Release|Win32"> | ||
13 | <Configuration>Release</Configuration> | ||
14 | <Platform>Win32</Platform> | ||
15 | </ProjectConfiguration> | ||
16 | <ProjectConfiguration Include="Debug|x64"> | ||
17 | <Configuration>Debug</Configuration> | ||
18 | <Platform>x64</Platform> | ||
19 | </ProjectConfiguration> | ||
20 | <ProjectConfiguration Include="Release|x64"> | ||
21 | <Configuration>Release</Configuration> | ||
22 | <Platform>x64</Platform> | ||
23 | </ProjectConfiguration> | ||
24 | </ItemGroup> | ||
25 | <PropertyGroup Label="Globals"> | ||
26 | <ProjectGuid>{3D44B67D-A475-49BA-8310-E39F6C117CC9}</ProjectGuid> | ||
27 | <ConfigurationType>Application</ConfigurationType> | ||
28 | <ProjectSubSystem>Console</ProjectSubSystem> | ||
29 | <TargetName>Example.TestEngine</TargetName> | ||
30 | <PlatformToolset>v141</PlatformToolset> | ||
31 | <CharacterSet>Unicode</CharacterSet> | ||
32 | <WindowsTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</WindowsTargetPlatformVersion> | ||
33 | </PropertyGroup> | ||
34 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
35 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
36 | <ImportGroup Label="ExtensionSettings"> | ||
37 | </ImportGroup> | ||
38 | <ImportGroup Label="Shared"> | ||
39 | <Import Project="..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets" Condition="Exists('..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" /> | ||
40 | </ImportGroup> | ||
41 | <PropertyGroup> | ||
42 | <ProjectAdditionalLinkLibraries> | ||
43 | </ProjectAdditionalLinkLibraries> | ||
44 | </PropertyGroup> | ||
45 | <ItemGroup> | ||
46 | <ClCompile Include="precomp.cpp"> | ||
47 | <PrecompiledHeader>Create</PrecompiledHeader> | ||
48 | </ClCompile> | ||
49 | <ClCompile Include="ShutdownEngine.cpp" /> | ||
50 | <ClCompile Include="ExampleTestEngine.cpp" /> | ||
51 | <ClCompile Include="TestEngine.cpp" /> | ||
52 | </ItemGroup> | ||
53 | <ItemGroup> | ||
54 | <ClInclude Include="precomp.h" /> | ||
55 | <ClInclude Include="TestEngine.h" /> | ||
56 | </ItemGroup> | ||
57 | <ItemGroup> | ||
58 | <None Include="packages.config" /> | ||
59 | </ItemGroup> | ||
60 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
61 | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild"> | ||
62 | <PropertyGroup> | ||
63 | <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> | ||
64 | </PropertyGroup> | ||
65 | <Error Condition="!Exists('..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\Nerdbank.GitVersioning.2.1.65\build\Nerdbank.GitVersioning.targets'))" /> | ||
66 | <Error Condition="!Exists('..\..\..\..\packages\WixToolset.BalUtil.4.0.12\build\WixToolset.BalUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.BalUtil.4.0.12\build\WixToolset.BalUtil.props'))" /> | ||
67 | <Error Condition="!Exists('..\..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.10\build\WixToolset.BootstrapperCore.Native.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.BootstrapperCore.Native.4.0.10\build\WixToolset.BootstrapperCore.Native.props'))" /> | ||
68 | <Error Condition="!Exists('..\..\..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\..\..\packages\WixToolset.DUtil.4.0.18\build\WixToolset.DUtil.props'))" /> | ||
69 | </Target> | ||
70 | </Project> \ No newline at end of file | ||
diff --git a/src/test/examples/TestEngine/ExampleTestEngine.cpp b/src/test/examples/TestEngine/ExampleTestEngine.cpp new file mode 100644 index 00000000..9f051875 --- /dev/null +++ b/src/test/examples/TestEngine/ExampleTestEngine.cpp | |||
@@ -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 | #include "precomp.h" | ||
4 | |||
5 | int __cdecl wmain(int argc, LPWSTR argv[]) | ||
6 | { | ||
7 | HRESULT hr = E_INVALIDARG; | ||
8 | |||
9 | ConsoleInitialize(); | ||
10 | |||
11 | if (argc != 2) | ||
12 | { | ||
13 | ConsoleWriteError(hr, CONSOLE_COLOR_RED, "Usage: Example.TestEngine.exe BA.dll"); | ||
14 | } | ||
15 | else | ||
16 | { | ||
17 | hr = RunShutdownEngine(argv[1]); | ||
18 | } | ||
19 | |||
20 | ConsoleUninitialize(); | ||
21 | return HRESULT_CODE(hr); | ||
22 | } | ||
diff --git a/src/test/examples/TestEngine/ShutdownEngine.cpp b/src/test/examples/TestEngine/ShutdownEngine.cpp new file mode 100644 index 00000000..69321d91 --- /dev/null +++ b/src/test/examples/TestEngine/ShutdownEngine.cpp | |||
@@ -0,0 +1,23 @@ | |||
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 wzBAFilePath | ||
7 | ) | ||
8 | { | ||
9 | HRESULT hr = S_OK; | ||
10 | TestEngine* pTestEngine = NULL; | ||
11 | |||
12 | pTestEngine = new TestEngine(); | ||
13 | ConsoleExitOnNull(pTestEngine, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to create new test engine."); | ||
14 | |||
15 | hr = pTestEngine->LoadBA(wzBAFilePath); | ||
16 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to load BA."); | ||
17 | |||
18 | hr = pTestEngine->SendShutdownEvent(BOOTSTRAPPER_SHUTDOWN_ACTION_RELOAD_BOOTSTRAPPER); | ||
19 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure for OnShutdown."); | ||
20 | |||
21 | LExit: | ||
22 | return hr; | ||
23 | } | ||
diff --git a/src/test/examples/TestEngine/TestEngine.cpp b/src/test/examples/TestEngine/TestEngine.cpp new file mode 100644 index 00000000..c0a62eda --- /dev/null +++ b/src/test/examples/TestEngine/TestEngine.cpp | |||
@@ -0,0 +1,117 @@ | |||
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::LoadBA( | ||
6 | __in LPCWSTR wzBAFilePath | ||
7 | ) | ||
8 | { | ||
9 | HRESULT hr = S_OK; | ||
10 | BOOTSTRAPPER_COMMAND command = { }; | ||
11 | BOOTSTRAPPER_CREATE_ARGS args = { }; | ||
12 | HMODULE hBAModule = NULL; | ||
13 | PFN_BOOTSTRAPPER_APPLICATION_CREATE pfnCreate = NULL; | ||
14 | |||
15 | if (m_pCreateResults) | ||
16 | { | ||
17 | ExitFunction1(hr = E_INVALIDSTATE); | ||
18 | } | ||
19 | |||
20 | LogInitialize(::GetModuleHandleW(NULL)); | ||
21 | |||
22 | hr = LogOpen(NULL, L"ExampleTestEngine", NULL, L"txt", FALSE, FALSE, NULL); | ||
23 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "Failed to open log."); | ||
24 | |||
25 | m_pCreateResults = static_cast<BOOTSTRAPPER_CREATE_RESULTS*>(MemAlloc(sizeof(BOOTSTRAPPER_CREATE_RESULTS), TRUE)); | ||
26 | |||
27 | command.cbSize = sizeof(BOOTSTRAPPER_COMMAND); | ||
28 | |||
29 | args.cbSize = sizeof(BOOTSTRAPPER_CREATE_ARGS); | ||
30 | args.pCommand = &command; | ||
31 | args.pfnBootstrapperEngineProc = TestEngine::EngineProc; | ||
32 | args.pvBootstrapperEngineProcContext = this; | ||
33 | args.qwEngineAPIVersion = MAKEQWORDVERSION(0, 0, 0, 1); | ||
34 | |||
35 | m_pCreateResults->cbSize = sizeof(BOOTSTRAPPER_CREATE_RESULTS); | ||
36 | |||
37 | hBAModule = ::LoadLibraryExW(wzBAFilePath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); | ||
38 | ExitOnNullWithLastError(hBAModule, hr, "Failed to load BA dll."); | ||
39 | |||
40 | pfnCreate = (PFN_BOOTSTRAPPER_APPLICATION_CREATE)::GetProcAddress(hBAModule, "BootstrapperApplicationCreate"); | ||
41 | ConsoleExitOnNull(pfnCreate, hr, E_OUTOFMEMORY, CONSOLE_COLOR_RED, "Failed to get address for BootstrapperApplicationCreate."); | ||
42 | |||
43 | hr = pfnCreate(&args, m_pCreateResults); | ||
44 | ConsoleExitOnFailure(hr, CONSOLE_COLOR_RED, "BA returned failure on BootstrapperApplicationCreate."); | ||
45 | |||
46 | LExit: | ||
47 | return hr; | ||
48 | } | ||
49 | |||
50 | HRESULT TestEngine::Log( | ||
51 | __in LPCWSTR wzMessage | ||
52 | ) | ||
53 | { | ||
54 | return ConsoleWriteLine(CONSOLE_COLOR_NORMAL, "%ls", wzMessage); | ||
55 | } | ||
56 | |||
57 | HRESULT TestEngine::SendShutdownEvent( | ||
58 | __in BOOTSTRAPPER_SHUTDOWN_ACTION defaultAction | ||
59 | ) | ||
60 | { | ||
61 | HRESULT hr = S_OK; | ||
62 | BA_ONSHUTDOWN_ARGS shutdownArgs = { }; | ||
63 | BA_ONSHUTDOWN_RESULTS shutdownResults = { }; | ||
64 | shutdownArgs.cbSize = sizeof(BA_ONSHUTDOWN_ARGS); | ||
65 | shutdownResults.action = defaultAction; | ||
66 | shutdownResults.cbSize = sizeof(BA_ONSHUTDOWN_RESULTS); | ||
67 | hr = m_pCreateResults->pfnBootstrapperApplicationProc(BOOTSTRAPPER_APPLICATION_MESSAGE_ONSHUTDOWN, &shutdownArgs, &shutdownResults, m_pCreateResults->pvBootstrapperApplicationProcContext); | ||
68 | return hr; | ||
69 | } | ||
70 | |||
71 | HRESULT TestEngine::BAEngineLog( | ||
72 | __in TestEngine* pContext, | ||
73 | __in BAENGINE_LOG_ARGS* pArgs, | ||
74 | __in BAENGINE_LOG_RESULTS* /*pResults*/ | ||
75 | ) | ||
76 | { | ||
77 | return pContext->Log(pArgs->wzMessage); | ||
78 | } | ||
79 | |||
80 | HRESULT WINAPI TestEngine::EngineProc( | ||
81 | __in BOOTSTRAPPER_ENGINE_MESSAGE message, | ||
82 | __in const LPVOID pvArgs, | ||
83 | __inout LPVOID pvResults, | ||
84 | __in_opt LPVOID pvContext | ||
85 | ) | ||
86 | { | ||
87 | HRESULT hr = S_OK; | ||
88 | TestEngine* pContext = (TestEngine*)pvContext; | ||
89 | |||
90 | if (!pContext || !pvArgs || !pvResults) | ||
91 | { | ||
92 | ExitFunction1(hr = E_INVALIDARG); | ||
93 | } | ||
94 | |||
95 | switch (message) | ||
96 | { | ||
97 | case BOOTSTRAPPER_ENGINE_MESSAGE_LOG: | ||
98 | hr = BAEngineLog(pContext, reinterpret_cast<BAENGINE_LOG_ARGS*>(pvArgs), reinterpret_cast<BAENGINE_LOG_RESULTS*>(pvResults)); | ||
99 | break; | ||
100 | default: | ||
101 | hr = E_NOTIMPL; | ||
102 | break; | ||
103 | } | ||
104 | |||
105 | LExit: | ||
106 | return hr; | ||
107 | } | ||
108 | |||
109 | TestEngine::TestEngine() | ||
110 | { | ||
111 | m_pCreateResults = NULL; | ||
112 | } | ||
113 | |||
114 | TestEngine::~TestEngine() | ||
115 | { | ||
116 | ReleaseMem(m_pCreateResults); | ||
117 | } \ No newline at end of file | ||
diff --git a/src/test/examples/TestEngine/TestEngine.h b/src/test/examples/TestEngine/TestEngine.h new file mode 100644 index 00000000..52872100 --- /dev/null +++ b/src/test/examples/TestEngine/TestEngine.h | |||
@@ -0,0 +1,42 @@ | |||
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 "precomp.h" | ||
5 | |||
6 | class TestEngine | ||
7 | { | ||
8 | public: | ||
9 | HRESULT LoadBA( | ||
10 | __in LPCWSTR wzBAFilePath | ||
11 | ); | ||
12 | |||
13 | HRESULT Log( | ||
14 | __in LPCWSTR wzMessage | ||
15 | ); | ||
16 | |||
17 | HRESULT SendShutdownEvent( | ||
18 | __in BOOTSTRAPPER_SHUTDOWN_ACTION defaultAction | ||
19 | ); | ||
20 | |||
21 | private: | ||
22 | static HRESULT BAEngineLog( | ||
23 | __in TestEngine* pContext, | ||
24 | __in BAENGINE_LOG_ARGS* pArgs, | ||
25 | __in BAENGINE_LOG_RESULTS* /*pResults*/ | ||
26 | ); | ||
27 | |||
28 | static HRESULT WINAPI EngineProc( | ||
29 | __in BOOTSTRAPPER_ENGINE_MESSAGE message, | ||
30 | __in const LPVOID pvArgs, | ||
31 | __inout LPVOID pvResults, | ||
32 | __in_opt LPVOID pvContext | ||
33 | ); | ||
34 | |||
35 | public: | ||
36 | TestEngine(); | ||
37 | |||
38 | ~TestEngine(); | ||
39 | |||
40 | private: | ||
41 | BOOTSTRAPPER_CREATE_RESULTS* m_pCreateResults; | ||
42 | }; \ No newline at end of file | ||
diff --git a/src/test/examples/TestEngine/packages.config b/src/test/examples/TestEngine/packages.config new file mode 100644 index 00000000..f209d5fb --- /dev/null +++ b/src/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="2.1.65" targetFramework="native" developmentDependency="true" /> | ||
4 | <package id="WixToolset.BootstrapperCore.Native" version="4.0.10" targetFramework="native" /> | ||
5 | <package id="WixToolset.BalUtil" version="4.0.12" targetFramework="native" /> | ||
6 | <package id="WixToolset.DUtil" version="4.0.18" targetFramework="native" /> | ||
7 | </packages> \ No newline at end of file | ||
diff --git a/src/test/examples/TestEngine/precomp.cpp b/src/test/examples/TestEngine/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/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/test/examples/TestEngine/precomp.h b/src/test/examples/TestEngine/precomp.h new file mode 100644 index 00000000..6e867e89 --- /dev/null +++ b/src/test/examples/TestEngine/precomp.h | |||
@@ -0,0 +1,19 @@ | |||
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 | |||
12 | #include "BootstrapperEngine.h" | ||
13 | #include "BootstrapperApplication.h" | ||
14 | |||
15 | #include "TestEngine.h" | ||
16 | |||
17 | HRESULT RunShutdownEngine( | ||
18 | __in LPCWSTR wzBAFilePath | ||
19 | ); | ||