diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2022-05-13 15:39:40 -0500 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2022-05-14 11:12:31 -0500 |
commit | d5985a1688bc878e42ffd3ce3939fa52303cab16 (patch) | |
tree | 0c283fe5454659c569317b37840a040474cfa032 /src/test | |
parent | 6a6974a15deb6edf593736cdb8043bfb93064782 (diff) | |
download | wix-d5985a1688bc878e42ffd3ce3939fa52303cab16.tar.gz wix-d5985a1688bc878e42ffd3ce3939fa52303cab16.tar.bz2 wix-d5985a1688bc878e42ffd3ce3939fa52303cab16.zip |
Add option to hosts to always install prereqs.
Add PrereqPackage to BundlePackage
Implements 4718
Diffstat (limited to 'src/test')
25 files changed, 799 insertions, 14 deletions
diff --git a/src/test/burn/TestBA/TestBA.cs b/src/test/burn/TestBA/TestBA.cs index 1548c05b..9ca82377 100644 --- a/src/test/burn/TestBA/TestBA.cs +++ b/src/test/burn/TestBA/TestBA.cs | |||
@@ -146,6 +146,13 @@ namespace WixToolset.Test.BA | |||
146 | 146 | ||
147 | this.wait.WaitOne(); | 147 | this.wait.WaitOne(); |
148 | 148 | ||
149 | if (this.action == LaunchAction.Help) | ||
150 | { | ||
151 | this.Log("This is a BA for automated testing"); | ||
152 | this.Engine.Quit(0); | ||
153 | return; | ||
154 | } | ||
155 | |||
149 | this.redetectRemaining = redetectCount; | 156 | this.redetectRemaining = redetectCount; |
150 | for (int i = -1; i < redetectCount; i++) | 157 | for (int i = -1; i < redetectCount; i++) |
151 | { | 158 | { |
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wixproj b/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wixproj index 0199f91f..b084997c 100644 --- a/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wixproj +++ b/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wixproj | |||
@@ -13,9 +13,12 @@ | |||
13 | </ItemGroup> | 13 | </ItemGroup> |
14 | <ItemGroup> | 14 | <ItemGroup> |
15 | <ProjectReference Include="..\PackageA\PackageA.wixproj" /> | 15 | <ProjectReference Include="..\PackageA\PackageA.wixproj" /> |
16 | <ProjectReference Include="..\PackageF\PackageF.wixproj" /> | 16 | <ProjectReference Include="..\PackageC\PackageC.wixproj" /> |
17 | <ProjectReference Include="..\PrereqBaf\PrereqBaf.vcxproj" /> | ||
18 | <ProjectReference Include="..\ReplaceConfig\ReplaceConfig.vcxproj" /> | ||
17 | </ItemGroup> | 19 | </ItemGroup> |
18 | <ItemGroup> | 20 | <ItemGroup> |
19 | <PackageReference Include="WixToolset.Bal.wixext" /> | 21 | <PackageReference Include="WixToolset.Bal.wixext" /> |
22 | <PackageReference Include="WixToolset.Util.wixext" /> | ||
20 | </ItemGroup> | 23 | </ItemGroup> |
21 | </Project> \ No newline at end of file | 24 | </Project> \ No newline at end of file |
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs b/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs index 682f0bd7..6073e09f 100644 --- a/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs +++ b/src/test/burn/TestData/PrereqBaTests/BundleA/BundleA.wxs | |||
@@ -1,22 +1,30 @@ | |||
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. --> | 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 | 2 | ||
3 | 3 | ||
4 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | 4 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> |
5 | <Fragment> | 5 | <Fragment> |
6 | <BootstrapperApplication Id="BrokenDnc"> | 6 | <BootstrapperApplication Id="BrokenDnc"> |
7 | <Payload SourceFile="!(bindpath.dncx86)\TestBA.deps.json" /> | 7 | <Payload SourceFile="!(bindpath.dncx86)\TestBA.deps.json" /> |
8 | <Payload SourceFile="!(bindpath.dncx86)\TestBA.dll" bal:BAFactoryAssembly="yes" /> | 8 | <Payload SourceFile="!(bindpath.dncx86)\TestBA.dll" bal:BAFactoryAssembly="yes" /> |
9 | <Payload Name="good.runtimeconfig.json" SourceFile="!(bindpath.dncx86)\TestBA.runtimeconfig.json" /> | ||
9 | <Payload Name="TestBA.runtimeconfig.json" SourceFile="bad.runtimeconfig.json" /> | 10 | <Payload Name="TestBA.runtimeconfig.json" SourceFile="bad.runtimeconfig.json" /> |
10 | <Payload SourceFile="!(bindpath.dncx86)\mbanative.dll" /> | 11 | <Payload SourceFile="!(bindpath.dncx86)\mbanative.dll" /> |
11 | <Payload SourceFile="!(bindpath.dncx86)\WixToolset.Mba.Core.dll" /> | 12 | <Payload SourceFile="!(bindpath.dncx86)\WixToolset.Mba.Core.dll" /> |
13 | <Payload SourceFile="$(var.PrereqBaf.TargetPath)" bal:BAFunctions="yes" /> | ||
12 | <bal:WixDotNetCoreBootstrapperApplicationHost /> | 14 | <bal:WixDotNetCoreBootstrapperApplicationHost /> |
13 | </BootstrapperApplication> | 15 | </BootstrapperApplication> |
14 | </Fragment> | 16 | </Fragment> |
15 | 17 | ||
16 | <Fragment> | 18 | <Fragment> |
19 | <util:FileSearch Variable="GoodConfigPresent" Path="[BARuntimeDirectory]\good.runtimeconfig.json" Result="exists" /> | ||
20 | <Variable Name="CAUSEINFINITELOOP" bal:Overridable="yes" /> | ||
21 | |||
17 | <PackageGroup Id="BundlePackages"> | 22 | <PackageGroup Id="BundlePackages"> |
23 | <ExePackage SourceFile="$(var.ReplaceConfig.TargetPath)" bal:PrereqPackage="yes" | ||
24 | Permanent="yes" DetectCondition="NOT GoodConfigPresent OR CAUSEINFINITELOOP = 1" | ||
25 | InstallArguments=""[BARuntimeDirectory]TestBA.runtimeconfig.json" "[BARuntimeDirectory]good.runtimeconfig.json" "[BARuntimeDirectory]bad.runtimeconfig.json"" /> | ||
18 | <MsiPackage Id="PackageA" SourceFile="$(var.PackageA.TargetPath)" bal:PrereqPackage="yes" Permanent="yes" /> | 26 | <MsiPackage Id="PackageA" SourceFile="$(var.PackageA.TargetPath)" bal:PrereqPackage="yes" Permanent="yes" /> |
19 | <MsiPackage Id="PackageF" SourceFile="$(var.PackageF.TargetPath)" Cache="force" /> | 27 | <MsiPackage Id="PackageC" SourceFile="$(var.PackageC.TargetPath)" Cache="force" /> |
20 | </PackageGroup> | 28 | </PackageGroup> |
21 | </Fragment> | 29 | </Fragment> |
22 | </Wix> | 30 | </Wix> |
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wixproj b/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wixproj index d4288d4b..843b382a 100644 --- a/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wixproj +++ b/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wixproj | |||
@@ -13,9 +13,12 @@ | |||
13 | </ItemGroup> | 13 | </ItemGroup> |
14 | <ItemGroup> | 14 | <ItemGroup> |
15 | <ProjectReference Include="..\PackageB\PackageB.wixproj" /> | 15 | <ProjectReference Include="..\PackageB\PackageB.wixproj" /> |
16 | <ProjectReference Include="..\PackageF\PackageF.wixproj" /> | 16 | <ProjectReference Include="..\PackageC\PackageC.wixproj" /> |
17 | <ProjectReference Include="..\PrereqBaf\PrereqBaf.vcxproj" /> | ||
18 | <ProjectReference Include="..\ReplaceConfig\ReplaceConfig.vcxproj" /> | ||
17 | </ItemGroup> | 19 | </ItemGroup> |
18 | <ItemGroup> | 20 | <ItemGroup> |
19 | <PackageReference Include="WixToolset.Bal.wixext" /> | 21 | <PackageReference Include="WixToolset.Bal.wixext" /> |
22 | <PackageReference Include="WixToolset.Util.wixext" /> | ||
20 | </ItemGroup> | 23 | </ItemGroup> |
21 | </Project> \ No newline at end of file | 24 | </Project> \ No newline at end of file |
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs b/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs index 603c3aee..b7742582 100644 --- a/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs +++ b/src/test/burn/TestData/PrereqBaTests/BundleB/BundleB.wxs | |||
@@ -1,21 +1,29 @@ | |||
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. --> | 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 | 2 | ||
3 | 3 | ||
4 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | 4 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> |
5 | <Fragment> | 5 | <Fragment> |
6 | <BootstrapperApplication Id="BrokenMba"> | 6 | <BootstrapperApplication Id="BrokenMba"> |
7 | <Payload Name="good.config" SourceFile="!(bindpath.net2x86)\TestBA.BootstrapperCore.config" /> | ||
7 | <Payload Name="WixToolset.Mba.Host.config" SourceFile="bad.config" /> | 8 | <Payload Name="WixToolset.Mba.Host.config" SourceFile="bad.config" /> |
8 | <Payload SourceFile="!(bindpath.net2x86)\TestBA.dll" /> | 9 | <Payload SourceFile="!(bindpath.net2x86)\TestBA.dll" /> |
9 | <Payload SourceFile="!(bindpath.net2x86)\mbanative.dll" /> | 10 | <Payload SourceFile="!(bindpath.net2x86)\mbanative.dll" /> |
10 | <Payload SourceFile="!(bindpath.net2x86)\WixToolset.Mba.Core.dll" /> | 11 | <Payload SourceFile="!(bindpath.net2x86)\WixToolset.Mba.Core.dll" /> |
12 | <Payload SourceFile="$(var.PrereqBaf.TargetPath)" bal:BAFunctions="yes" /> | ||
11 | <bal:WixManagedBootstrapperApplicationHost /> | 13 | <bal:WixManagedBootstrapperApplicationHost /> |
12 | </BootstrapperApplication> | 14 | </BootstrapperApplication> |
13 | </Fragment> | 15 | </Fragment> |
14 | 16 | ||
15 | <Fragment> | 17 | <Fragment> |
18 | <util:FileSearch Variable="GoodConfigPresent" Path="[BARuntimeDirectory]\good.config" Result="exists" /> | ||
19 | <Variable Name="CAUSEINFINITELOOP" bal:Overridable="yes" /> | ||
20 | |||
16 | <PackageGroup Id="BundlePackages"> | 21 | <PackageGroup Id="BundlePackages"> |
22 | <ExePackage SourceFile="$(var.ReplaceConfig.TargetPath)" bal:PrereqPackage="yes" | ||
23 | Permanent="yes" DetectCondition="NOT GoodConfigPresent OR CAUSEINFINITELOOP = 1" | ||
24 | InstallArguments=""[BARuntimeDirectory]WixToolset.Mba.Host.config" "[BARuntimeDirectory]good.config" "[BARuntimeDirectory]bad.config"" /> | ||
17 | <MsiPackage Id="PackageB" SourceFile="$(var.PackageB.TargetPath)" bal:PrereqPackage="yes" Permanent="yes" /> | 25 | <MsiPackage Id="PackageB" SourceFile="$(var.PackageB.TargetPath)" bal:PrereqPackage="yes" Permanent="yes" /> |
18 | <MsiPackage Id="PackageF" SourceFile="$(var.PackageF.TargetPath)" /> | 26 | <MsiPackage Id="PackageC" SourceFile="$(var.PackageC.TargetPath)" /> |
19 | </PackageGroup> | 27 | </PackageGroup> |
20 | </Fragment> | 28 | </Fragment> |
21 | </Wix> | 29 | </Wix> |
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wixproj b/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wixproj new file mode 100644 index 00000000..81641f66 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wixproj | |||
@@ -0,0 +1,24 @@ | |||
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 | <PropertyGroup> | ||
4 | <OutputType>Bundle</OutputType> | ||
5 | <BA>BrokenDncAlwaysPrereq</BA> | ||
6 | <UpgradeCode>{D2763AB7-979B-485C-AE52-DD03C23CCB93}</UpgradeCode> | ||
7 | </PropertyGroup> | ||
8 | <ItemGroup> | ||
9 | <Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" /> | ||
10 | </ItemGroup> | ||
11 | <ItemGroup> | ||
12 | <BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net6.0-windows\win-x86" BindName="dncx86" /> | ||
13 | </ItemGroup> | ||
14 | <ItemGroup> | ||
15 | <ProjectReference Include="..\PackageA\PackageA.wixproj" /> | ||
16 | <ProjectReference Include="..\PackageC\PackageC.wixproj" /> | ||
17 | <ProjectReference Include="..\PrereqBaf\PrereqBaf.vcxproj" /> | ||
18 | <ProjectReference Include="..\ReplaceConfig\ReplaceConfig.vcxproj" /> | ||
19 | </ItemGroup> | ||
20 | <ItemGroup> | ||
21 | <PackageReference Include="WixToolset.Bal.wixext" /> | ||
22 | <PackageReference Include="WixToolset.Util.wixext" /> | ||
23 | </ItemGroup> | ||
24 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs b/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs new file mode 100644 index 00000000..fe9425f7 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/BundleC/BundleC.wxs | |||
@@ -0,0 +1,30 @@ | |||
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 | |||
4 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> | ||
5 | <Fragment> | ||
6 | <BootstrapperApplication Id="BrokenDncAlwaysPrereq"> | ||
7 | <Payload SourceFile="!(bindpath.dncx86)\TestBA.deps.json" /> | ||
8 | <Payload SourceFile="!(bindpath.dncx86)\TestBA.dll" bal:BAFactoryAssembly="yes" /> | ||
9 | <Payload Name="good.runtimeconfig.json" SourceFile="!(bindpath.dncx86)\TestBA.runtimeconfig.json" /> | ||
10 | <Payload Name="TestBA.runtimeconfig.json" SourceFile="bad.runtimeconfig.json" /> | ||
11 | <Payload SourceFile="!(bindpath.dncx86)\mbanative.dll" /> | ||
12 | <Payload SourceFile="!(bindpath.dncx86)\WixToolset.Mba.Core.dll" /> | ||
13 | <Payload SourceFile="$(var.PrereqBaf.TargetPath)" bal:BAFunctions="yes" /> | ||
14 | <bal:WixDotNetCoreBootstrapperApplicationHost AlwaysInstallPrereqs="yes" /> | ||
15 | </BootstrapperApplication> | ||
16 | </Fragment> | ||
17 | |||
18 | <Fragment> | ||
19 | <util:FileSearch Variable="GoodConfigPresent" Path="[BARuntimeDirectory]\good.runtimeconfig.json" Result="exists" /> | ||
20 | <Variable Name="CAUSEINFINITELOOP" bal:Overridable="yes" /> | ||
21 | |||
22 | <PackageGroup Id="BundlePackages"> | ||
23 | <ExePackage SourceFile="$(var.ReplaceConfig.TargetPath)" bal:PrereqPackage="yes" | ||
24 | Permanent="yes" DetectCondition="NOT GoodConfigPresent OR CAUSEINFINITELOOP = 1" | ||
25 | InstallArguments=""[BARuntimeDirectory]TestBA.runtimeconfig.json" "[BARuntimeDirectory]good.runtimeconfig.json" "[BARuntimeDirectory]bad.runtimeconfig.json"" /> | ||
26 | <MsiPackage Id="PackageA" SourceFile="$(var.PackageA.TargetPath)" bal:PrereqPackage="yes" Permanent="yes" /> | ||
27 | <MsiPackage Id="PackageC" SourceFile="$(var.PackageC.TargetPath)" Cache="force" /> | ||
28 | </PackageGroup> | ||
29 | </Fragment> | ||
30 | </Wix> | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleC/bad.runtimeconfig.json b/src/test/burn/TestData/PrereqBaTests/BundleC/bad.runtimeconfig.json new file mode 100644 index 00000000..07a1a830 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/BundleC/bad.runtimeconfig.json | |||
@@ -0,0 +1,10 @@ | |||
1 | { | ||
2 | "runtimeOptions": { | ||
3 | "tfm": "net5.5", | ||
4 | "rollForward": "Disable", | ||
5 | "framework": { | ||
6 | "name": "Microsoft.WindowsDesktop.App", | ||
7 | "version": "5.5.0" | ||
8 | } | ||
9 | } | ||
10 | } \ No newline at end of file | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wixproj b/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wixproj new file mode 100644 index 00000000..314fe2e2 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wixproj | |||
@@ -0,0 +1,24 @@ | |||
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 | <PropertyGroup> | ||
4 | <OutputType>Bundle</OutputType> | ||
5 | <BA>BrokenMbaAlwaysPrereq</BA> | ||
6 | <UpgradeCode>{415CA128-60E1-4D16-ACE8-A1D43E98B997}</UpgradeCode> | ||
7 | </PropertyGroup> | ||
8 | <ItemGroup> | ||
9 | <Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" /> | ||
10 | </ItemGroup> | ||
11 | <ItemGroup> | ||
12 | <BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net35\win-x86" BindName="net2x86" /> | ||
13 | </ItemGroup> | ||
14 | <ItemGroup> | ||
15 | <ProjectReference Include="..\PackageB\PackageB.wixproj" /> | ||
16 | <ProjectReference Include="..\PackageC\PackageC.wixproj" /> | ||
17 | <ProjectReference Include="..\PrereqBaf\PrereqBaf.vcxproj" /> | ||
18 | <ProjectReference Include="..\ReplaceConfig\ReplaceConfig.vcxproj" /> | ||
19 | </ItemGroup> | ||
20 | <ItemGroup> | ||
21 | <PackageReference Include="WixToolset.Bal.wixext" /> | ||
22 | <PackageReference Include="WixToolset.Util.wixext" /> | ||
23 | </ItemGroup> | ||
24 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wxs b/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wxs new file mode 100644 index 00000000..0e866295 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/BundleD/BundleD.wxs | |||
@@ -0,0 +1,29 @@ | |||
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 | |||
4 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> | ||
5 | <Fragment> | ||
6 | <BootstrapperApplication Id="BrokenMbaAlwaysPrereq"> | ||
7 | <Payload Name="good.config" SourceFile="!(bindpath.net2x86)\TestBA.BootstrapperCore.config" /> | ||
8 | <Payload Name="WixToolset.Mba.Host.config" SourceFile="bad.config" /> | ||
9 | <Payload SourceFile="!(bindpath.net2x86)\TestBA.dll" /> | ||
10 | <Payload SourceFile="!(bindpath.net2x86)\mbanative.dll" /> | ||
11 | <Payload SourceFile="!(bindpath.net2x86)\WixToolset.Mba.Core.dll" /> | ||
12 | <Payload SourceFile="$(var.PrereqBaf.TargetPath)" bal:BAFunctions="yes" /> | ||
13 | <bal:WixManagedBootstrapperApplicationHost AlwaysInstallPrereqs="yes" /> | ||
14 | </BootstrapperApplication> | ||
15 | </Fragment> | ||
16 | |||
17 | <Fragment> | ||
18 | <util:FileSearch Variable="GoodConfigPresent" Path="[BARuntimeDirectory]\good.config" Result="exists" /> | ||
19 | <Variable Name="CAUSEINFINITELOOP" bal:Overridable="yes" /> | ||
20 | |||
21 | <PackageGroup Id="BundlePackages"> | ||
22 | <ExePackage SourceFile="$(var.ReplaceConfig.TargetPath)" bal:PrereqPackage="yes" | ||
23 | Permanent="yes" DetectCondition="NOT GoodConfigPresent OR CAUSEINFINITELOOP = 1" | ||
24 | InstallArguments=""[BARuntimeDirectory]WixToolset.Mba.Host.config" "[BARuntimeDirectory]good.config" "[BARuntimeDirectory]bad.config"" /> | ||
25 | <MsiPackage Id="PackageB" SourceFile="$(var.PackageB.TargetPath)" bal:PrereqPackage="yes" Permanent="yes" /> | ||
26 | <MsiPackage Id="PackageC" SourceFile="$(var.PackageC.TargetPath)" /> | ||
27 | </PackageGroup> | ||
28 | </Fragment> | ||
29 | </Wix> | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleD/bad.config b/src/test/burn/TestData/PrereqBaTests/BundleD/bad.config new file mode 100644 index 00000000..1512e59a --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/BundleD/bad.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=v5.8" /> | ||
13 | </startup> | ||
14 | <wix.bootstrapper> | ||
15 | <host assemblyName="TestBA" /> | ||
16 | </wix.bootstrapper> | ||
17 | </configuration> | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wixproj b/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wixproj new file mode 100644 index 00000000..5d271f55 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wixproj | |||
@@ -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 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <PropertyGroup> | ||
4 | <OutputType>Bundle</OutputType> | ||
5 | <BA>DncAlwaysPrereq</BA> | ||
6 | <UpgradeCode>{2F61ECD8-C28B-4FF9-9609-0E9633716CF9}</UpgradeCode> | ||
7 | </PropertyGroup> | ||
8 | <ItemGroup> | ||
9 | <Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" /> | ||
10 | </ItemGroup> | ||
11 | <ItemGroup> | ||
12 | <BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net6.0-windows\win-x86" BindName="dncx86" /> | ||
13 | </ItemGroup> | ||
14 | <ItemGroup> | ||
15 | <ProjectReference Include="..\PrereqBaf\PrereqBaf.vcxproj" /> | ||
16 | <ProjectReference Include="..\ReplaceConfig\ReplaceConfig.vcxproj" /> | ||
17 | </ItemGroup> | ||
18 | <ItemGroup> | ||
19 | <PackageReference Include="WixToolset.Bal.wixext" /> | ||
20 | <PackageReference Include="WixToolset.Util.wixext" /> | ||
21 | </ItemGroup> | ||
22 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs b/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs new file mode 100644 index 00000000..5f2e6a75 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/BundleE/BundleE.wxs | |||
@@ -0,0 +1,26 @@ | |||
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 | |||
4 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal" xmlns:util="http://wixtoolset.org/schemas/v4/wxs/util"> | ||
5 | <Fragment> | ||
6 | <BootstrapperApplication Id="DncAlwaysPrereq"> | ||
7 | <Payload SourceFile="!(bindpath.dncx86)\TestBA.deps.json" /> | ||
8 | <Payload SourceFile="!(bindpath.dncx86)\TestBA.dll" bal:BAFactoryAssembly="yes" /> | ||
9 | <Payload SourceFile="!(bindpath.dncx86)\TestBA.runtimeconfig.json" /> | ||
10 | <Payload SourceFile="!(bindpath.dncx86)\mbanative.dll" /> | ||
11 | <Payload SourceFile="!(bindpath.dncx86)\WixToolset.Mba.Core.dll" /> | ||
12 | <Payload SourceFile="$(var.PrereqBaf.TargetPath)" bal:BAFunctions="yes" /> | ||
13 | <bal:WixDotNetCoreBootstrapperApplicationHost AlwaysInstallPrereqs="yes" /> | ||
14 | </BootstrapperApplication> | ||
15 | </Fragment> | ||
16 | |||
17 | <Fragment> | ||
18 | <util:FileSearch Variable="GoodConfigPresent" Path="[BARuntimeDirectory]\good.runtimeconfig.json" Result="exists" /> | ||
19 | |||
20 | <PackageGroup Id="BundlePackages"> | ||
21 | <ExePackage SourceFile="$(var.ReplaceConfig.TargetPath)" bal:PrereqPackage="yes" | ||
22 | Permanent="yes" DetectCondition="NOT GoodConfigPresent" | ||
23 | InstallArguments=""[BARuntimeDirectory]TestBA.runtimeconfig.json" "[BARuntimeDirectory]good.runtimeconfig.json" "[BARuntimeDirectory]bad.runtimeconfig.json"" /> | ||
24 | </PackageGroup> | ||
25 | </Fragment> | ||
26 | </Wix> | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/PackageF/PackageF.wixproj b/src/test/burn/TestData/PrereqBaTests/PackageC/PackageC.wixproj index 00ffb7d8..1c8c4fa8 100644 --- a/src/test/burn/TestData/PrereqBaTests/PackageF/PackageF.wixproj +++ b/src/test/burn/TestData/PrereqBaTests/PackageC/PackageC.wixproj | |||
@@ -4,9 +4,6 @@ | |||
4 | <UpgradeCode>{7DEEE928-CD7F-49AD-8000-2ED6339D8A78}</UpgradeCode> | 4 | <UpgradeCode>{7DEEE928-CD7F-49AD-8000-2ED6339D8A78}</UpgradeCode> |
5 | </PropertyGroup> | 5 | </PropertyGroup> |
6 | <ItemGroup> | 6 | <ItemGroup> |
7 | <Compile Include="..\..\Templates\PackageFail.wxs" Link="PackageFail.wxs" /> | 7 | <Compile Include="..\..\Templates\Package.wxs" Link="Package.wxs" /> |
8 | </ItemGroup> | ||
9 | <ItemGroup> | ||
10 | <PackageReference Include="WixToolset.Util.wixext" /> | ||
11 | </ItemGroup> | 8 | </ItemGroup> |
12 | </Project> \ No newline at end of file | 9 | </Project> \ No newline at end of file |
diff --git a/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp new file mode 100644 index 00000000..35949eb9 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.cpp | |||
@@ -0,0 +1,79 @@ | |||
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 | #include "BalBaseBAFunctions.h" | ||
5 | #include "BalBaseBAFunctionsProc.h" | ||
6 | |||
7 | class CPrereqBaf : public CBalBaseBAFunctions | ||
8 | { | ||
9 | public: // IBAFunctions | ||
10 | |||
11 | public: //IBootstrapperApplication | ||
12 | |||
13 | virtual STDMETHODIMP OnDetectBegin( | ||
14 | __in BOOL /*fCached*/, | ||
15 | __in BOOTSTRAPPER_REGISTRATION_TYPE /*registrationType*/, | ||
16 | __in DWORD /*cPackages*/, | ||
17 | __inout BOOL* /*pfCancel*/ | ||
18 | ) | ||
19 | { | ||
20 | HRESULT hr = S_OK; | ||
21 | |||
22 | hr = m_pEngine->SetVariableString(L"BARuntimeDirectory", m_command.wzBootstrapperWorkingFolder, FALSE); | ||
23 | ExitOnFailure(hr, "Failed to set BARuntimeDirectory"); | ||
24 | |||
25 | LExit: | ||
26 | return hr; | ||
27 | } | ||
28 | |||
29 | private: | ||
30 | |||
31 | public: | ||
32 | // | ||
33 | // Constructor - initialize member variables. | ||
34 | // | ||
35 | CPrereqBaf( | ||
36 | __in HMODULE hModule, | ||
37 | __in IBootstrapperEngine* pEngine, | ||
38 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs | ||
39 | ) : CBalBaseBAFunctions(hModule, pEngine, pArgs) | ||
40 | { | ||
41 | } | ||
42 | |||
43 | // | ||
44 | // Destructor - release member variables. | ||
45 | // | ||
46 | ~CPrereqBaf() | ||
47 | { | ||
48 | } | ||
49 | |||
50 | private: | ||
51 | }; | ||
52 | |||
53 | |||
54 | HRESULT WINAPI CreateBAFunctions( | ||
55 | __in HMODULE hModule, | ||
56 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, | ||
57 | __inout BA_FUNCTIONS_CREATE_RESULTS* pResults | ||
58 | ) | ||
59 | { | ||
60 | HRESULT hr = S_OK; | ||
61 | CPrereqBaf* pBAFunctions = NULL; | ||
62 | IBootstrapperEngine* pEngine = NULL; | ||
63 | |||
64 | hr = BalInitializeFromCreateArgs(pArgs->pBootstrapperCreateArgs, &pEngine); | ||
65 | ExitOnFailure(hr, "Failed to initialize Bal."); | ||
66 | |||
67 | pBAFunctions = new CPrereqBaf(hModule, pEngine, pArgs); | ||
68 | ExitOnNull(pBAFunctions, hr, E_OUTOFMEMORY, "Failed to create new CPrereqBaf object."); | ||
69 | |||
70 | pResults->pfnBAFunctionsProc = BalBaseBAFunctionsProc; | ||
71 | pResults->pvBAFunctionsProcContext = pBAFunctions; | ||
72 | pBAFunctions = NULL; | ||
73 | |||
74 | LExit: | ||
75 | ReleaseObject(pBAFunctions); | ||
76 | ReleaseObject(pEngine); | ||
77 | |||
78 | return hr; | ||
79 | } | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.def b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.def new file mode 100644 index 00000000..6e016dad --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.def | |||
@@ -0,0 +1,6 @@ | |||
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 | |||
4 | EXPORTS | ||
5 | BAFunctionsCreate | ||
6 | BAFunctionsDestroy | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.vcxproj b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.vcxproj new file mode 100644 index 00000000..0d8d63be --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/PrereqBaf.vcxproj | |||
@@ -0,0 +1,66 @@ | |||
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 DefaultTargets="Build" Toolsxmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
5 | <ItemGroup Label="ProjectConfigurations"> | ||
6 | <ProjectConfiguration Include="Debug|ARM64"> | ||
7 | <Configuration>Debug</Configuration> | ||
8 | <Platform>ARM64</Platform> | ||
9 | </ProjectConfiguration> | ||
10 | <ProjectConfiguration Include="Release|ARM64"> | ||
11 | <Configuration>Release</Configuration> | ||
12 | <Platform>ARM64</Platform> | ||
13 | </ProjectConfiguration> | ||
14 | <ProjectConfiguration Include="Debug|Win32"> | ||
15 | <Configuration>Debug</Configuration> | ||
16 | <Platform>Win32</Platform> | ||
17 | </ProjectConfiguration> | ||
18 | <ProjectConfiguration Include="Release|Win32"> | ||
19 | <Configuration>Release</Configuration> | ||
20 | <Platform>Win32</Platform> | ||
21 | </ProjectConfiguration> | ||
22 | <ProjectConfiguration Include="Debug|x64"> | ||
23 | <Configuration>Debug</Configuration> | ||
24 | <Platform>x64</Platform> | ||
25 | </ProjectConfiguration> | ||
26 | <ProjectConfiguration Include="Release|x64"> | ||
27 | <Configuration>Release</Configuration> | ||
28 | <Platform>x64</Platform> | ||
29 | </ProjectConfiguration> | ||
30 | </ItemGroup> | ||
31 | |||
32 | <PropertyGroup Label="Globals"> | ||
33 | <ProjectGuid>{C0A11DDB-6CCE-44EC-88FD-93910C2916E3}</ProjectGuid> | ||
34 | <ConfigurationType>DynamicLibrary</ConfigurationType> | ||
35 | <CharacterSet>Unicode</CharacterSet> | ||
36 | <TargetName>PrereqBaf</TargetName> | ||
37 | <ProjectModuleDefinitionFile>PrereqBaf.def</ProjectModuleDefinitionFile> | ||
38 | <IsWixTestProject>true</IsWixTestProject> | ||
39 | </PropertyGroup> | ||
40 | |||
41 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
42 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
43 | |||
44 | <PropertyGroup> | ||
45 | <ProjectAdditionalLinkLibraries>comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib</ProjectAdditionalLinkLibraries> | ||
46 | </PropertyGroup> | ||
47 | |||
48 | <ItemGroup> | ||
49 | <ClCompile Include="precomp.cpp"> | ||
50 | <PrecompiledHeader>Create</PrecompiledHeader> | ||
51 | </ClCompile> | ||
52 | <ClCompile Include="PrereqBaf.cpp" /> | ||
53 | </ItemGroup> | ||
54 | <ItemGroup> | ||
55 | <ClInclude Include="precomp.h" /> | ||
56 | </ItemGroup> | ||
57 | <ItemGroup> | ||
58 | <None Include="PrereqBaf.def" /> | ||
59 | </ItemGroup> | ||
60 | |||
61 | <ItemGroup> | ||
62 | <PackageReference Include="WixToolset.BalUtil" /> | ||
63 | </ItemGroup> | ||
64 | |||
65 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
66 | </Project> | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/PrereqBaf/precomp.cpp b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/precomp.cpp new file mode 100644 index 00000000..fc9d1177 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/precomp.cpp | |||
@@ -0,0 +1,48 @@ | |||
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 | static HINSTANCE vhInstance = NULL; | ||
6 | |||
7 | extern "C" BOOL WINAPI DllMain( | ||
8 | IN HINSTANCE hInstance, | ||
9 | IN DWORD dwReason, | ||
10 | IN LPVOID /* pvReserved */ | ||
11 | ) | ||
12 | { | ||
13 | switch (dwReason) | ||
14 | { | ||
15 | case DLL_PROCESS_ATTACH: | ||
16 | ::DisableThreadLibraryCalls(hInstance); | ||
17 | vhInstance = hInstance; | ||
18 | break; | ||
19 | |||
20 | case DLL_PROCESS_DETACH: | ||
21 | vhInstance = NULL; | ||
22 | break; | ||
23 | } | ||
24 | |||
25 | return TRUE; | ||
26 | } | ||
27 | |||
28 | extern "C" HRESULT WINAPI BAFunctionsCreate( | ||
29 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, | ||
30 | __inout BA_FUNCTIONS_CREATE_RESULTS* pResults | ||
31 | ) | ||
32 | { | ||
33 | HRESULT hr = S_OK; | ||
34 | |||
35 | hr = CreateBAFunctions(vhInstance, pArgs, pResults); | ||
36 | BalExitOnFailure(hr, "Failed to create BAFunctions interface."); | ||
37 | |||
38 | LExit: | ||
39 | return hr; | ||
40 | } | ||
41 | |||
42 | extern "C" void WINAPI BAFunctionsDestroy( | ||
43 | __in const BA_FUNCTIONS_DESTROY_ARGS* /*pArgs*/, | ||
44 | __inout BA_FUNCTIONS_DESTROY_RESULTS* /*pResults*/ | ||
45 | ) | ||
46 | { | ||
47 | BalUninitialize(); | ||
48 | } | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/PrereqBaf/precomp.h b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/precomp.h new file mode 100644 index 00000000..8320bdd8 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/PrereqBaf/precomp.h | |||
@@ -0,0 +1,31 @@ | |||
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 | #include <windows.h> | ||
6 | #include <msiquery.h> | ||
7 | #include <objbase.h> | ||
8 | #include <shlobj.h> | ||
9 | #include <shlwapi.h> | ||
10 | #include <stdlib.h> | ||
11 | #include <strsafe.h> | ||
12 | #include <CommCtrl.h> | ||
13 | |||
14 | #include "dutil.h" | ||
15 | #include "dictutil.h" | ||
16 | #include "fileutil.h" | ||
17 | #include "locutil.h" | ||
18 | #include "pathutil.h" | ||
19 | #include "strutil.h" | ||
20 | |||
21 | #include "BalBaseBootstrapperApplication.h" | ||
22 | #include "balutil.h" | ||
23 | |||
24 | #include "BAFunctions.h" | ||
25 | #include "IBAFunctions.h" | ||
26 | |||
27 | HRESULT WINAPI CreateBAFunctions( | ||
28 | __in HMODULE hModule, | ||
29 | __in const BA_FUNCTIONS_CREATE_ARGS* pArgs, | ||
30 | __inout BA_FUNCTIONS_CREATE_RESULTS* pResults | ||
31 | ); | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp new file mode 100644 index 00000000..1fa71bc2 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.cpp | |||
@@ -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 | #include "precomp.h" | ||
4 | |||
5 | int __cdecl wmain( | ||
6 | __in int argc, | ||
7 | __in LPWSTR argv[] | ||
8 | ) | ||
9 | { | ||
10 | HRESULT hr = S_OK; | ||
11 | DWORD dwExitCode = 0; | ||
12 | LPCWSTR wzDestinationFile = argc > 1 ? argv[1] : NULL; | ||
13 | LPCWSTR wzGoodFile = argc > 2 ? argv[2] : NULL; | ||
14 | LPCWSTR wzBadFile = argc > 3 ? argv[3] : NULL; | ||
15 | |||
16 | if (argc != 4) | ||
17 | { | ||
18 | ExitWithRootFailure(hr, E_INVALIDARG, "Invalid args"); | ||
19 | } | ||
20 | |||
21 | if (!::MoveFileW(wzDestinationFile, wzBadFile)) | ||
22 | { | ||
23 | ExitWithLastError(hr, "Failed to move bad file"); | ||
24 | } | ||
25 | |||
26 | if (!::MoveFileW(wzGoodFile, wzDestinationFile)) | ||
27 | { | ||
28 | ExitWithLastError(hr, "Failed to move good file"); | ||
29 | } | ||
30 | |||
31 | LExit: | ||
32 | return FAILED(hr) ? (int)hr : (int)dwExitCode; | ||
33 | } | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.vcxproj b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.vcxproj new file mode 100644 index 00000000..c5d7b046 --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/ReplaceConfig.vcxproj | |||
@@ -0,0 +1,63 @@ | |||
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 DefaultTargets="Build" Toolsxmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
5 | <ItemGroup Label="ProjectConfigurations"> | ||
6 | <ProjectConfiguration Include="Debug|ARM64"> | ||
7 | <Configuration>Debug</Configuration> | ||
8 | <Platform>ARM64</Platform> | ||
9 | </ProjectConfiguration> | ||
10 | <ProjectConfiguration Include="Release|ARM64"> | ||
11 | <Configuration>Release</Configuration> | ||
12 | <Platform>ARM64</Platform> | ||
13 | </ProjectConfiguration> | ||
14 | <ProjectConfiguration Include="Debug|Win32"> | ||
15 | <Configuration>Debug</Configuration> | ||
16 | <Platform>Win32</Platform> | ||
17 | </ProjectConfiguration> | ||
18 | <ProjectConfiguration Include="Release|Win32"> | ||
19 | <Configuration>Release</Configuration> | ||
20 | <Platform>Win32</Platform> | ||
21 | </ProjectConfiguration> | ||
22 | <ProjectConfiguration Include="Debug|x64"> | ||
23 | <Configuration>Debug</Configuration> | ||
24 | <Platform>x64</Platform> | ||
25 | </ProjectConfiguration> | ||
26 | <ProjectConfiguration Include="Release|x64"> | ||
27 | <Configuration>Release</Configuration> | ||
28 | <Platform>x64</Platform> | ||
29 | </ProjectConfiguration> | ||
30 | </ItemGroup> | ||
31 | |||
32 | <PropertyGroup Label="Globals"> | ||
33 | <ProjectGuid>{3D10A07D-3321-4F8E-B884-951F8FB5D636}</ProjectGuid> | ||
34 | <ConfigurationType>Application</ConfigurationType> | ||
35 | <ProjectSubSystem>Console</ProjectSubSystem> | ||
36 | <CharacterSet>Unicode</CharacterSet> | ||
37 | <TargetName>ReplaceConfig</TargetName> | ||
38 | <IsWixTestProject>true</IsWixTestProject> | ||
39 | </PropertyGroup> | ||
40 | |||
41 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
42 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
43 | |||
44 | <PropertyGroup> | ||
45 | <ProjectAdditionalLinkLibraries>comctl32.lib;gdiplus.lib;msimg32.lib;shlwapi.lib;wininet.lib</ProjectAdditionalLinkLibraries> | ||
46 | </PropertyGroup> | ||
47 | |||
48 | <ItemGroup> | ||
49 | <ClCompile Include="precomp.cpp"> | ||
50 | <PrecompiledHeader>Create</PrecompiledHeader> | ||
51 | </ClCompile> | ||
52 | <ClCompile Include="ReplaceConfig.cpp" /> | ||
53 | </ItemGroup> | ||
54 | <ItemGroup> | ||
55 | <ClInclude Include="precomp.h" /> | ||
56 | </ItemGroup> | ||
57 | |||
58 | <ItemGroup> | ||
59 | <PackageReference Include="WixToolset.DUtil" /> | ||
60 | </ItemGroup> | ||
61 | |||
62 | <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
63 | </Project> | ||
diff --git a/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/precomp.cpp b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/precomp.cpp new file mode 100644 index 00000000..37664a1c --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/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/burn/TestData/PrereqBaTests/ReplaceConfig/precomp.h b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/precomp.h new file mode 100644 index 00000000..f4180c2e --- /dev/null +++ b/src/test/burn/TestData/PrereqBaTests/ReplaceConfig/precomp.h | |||
@@ -0,0 +1,17 @@ | |||
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 | #include <windows.h> | ||
6 | #include <msiquery.h> | ||
7 | #include <objbase.h> | ||
8 | #include <shlobj.h> | ||
9 | #include <shlwapi.h> | ||
10 | #include <stdlib.h> | ||
11 | #include <strsafe.h> | ||
12 | #include <CommCtrl.h> | ||
13 | |||
14 | #include "dutil.h" | ||
15 | #include "fileutil.h" | ||
16 | #include "pathutil.h" | ||
17 | #include "strutil.h" | ||
diff --git a/src/test/burn/WixTestTools/BundleInstaller.cs b/src/test/burn/WixTestTools/BundleInstaller.cs index 2b449ebf..0ab02d1b 100644 --- a/src/test/burn/WixTestTools/BundleInstaller.cs +++ b/src/test/burn/WixTestTools/BundleInstaller.cs | |||
@@ -27,6 +27,20 @@ namespace WixTestTools | |||
27 | public string TestName { get; } | 27 | public string TestName { get; } |
28 | 28 | ||
29 | /// <summary> | 29 | /// <summary> |
30 | /// Runs the bundle asking for help. | ||
31 | /// </summary> | ||
32 | /// <param name="expectedExitCode">Expected exit code, defaults to success.</param> | ||
33 | /// <param name="arguments">Optional arguments to pass to the tool.</param> | ||
34 | /// <returns>Path to the generated log file.</returns> | ||
35 | public string Help(int expectedExitCode = (int)MSIExec.MSIExecReturnCode.SUCCESS, params string[] arguments) | ||
36 | { | ||
37 | var newArgumentList = new List<string>(); | ||
38 | newArgumentList.Add("-help"); | ||
39 | newArgumentList.AddRange(arguments); | ||
40 | return this.RunBundleWithArguments(expectedExitCode, MSIExec.MSIExecMode.Custom, newArgumentList.ToArray()); | ||
41 | } | ||
42 | |||
43 | /// <summary> | ||
30 | /// Installs the bundle with optional arguments. | 44 | /// Installs the bundle with optional arguments. |
31 | /// </summary> | 45 | /// </summary> |
32 | /// <param name="expectedExitCode">Expected exit code, defaults to success.</param> | 46 | /// <param name="expectedExitCode">Expected exit code, defaults to success.</param> |
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/PrereqBaTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/PrereqBaTests.cs index 52e165b4..d958b454 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/PrereqBaTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/PrereqBaTests.cs | |||
@@ -18,6 +18,39 @@ namespace WixToolsetTest.BurnE2E | |||
18 | /// This bundle purposely provides a .runtimeconfig.json file that requires a version of .NET Core that doesn't exist, | 18 | /// This bundle purposely provides a .runtimeconfig.json file that requires a version of .NET Core that doesn't exist, |
19 | /// with an MSI package to represent the prerequisite package. | 19 | /// with an MSI package to represent the prerequisite package. |
20 | /// This verifies that: | 20 | /// This verifies that: |
21 | /// The preqba doesn't infinitely try to install prereqs. | ||
22 | /// The engine automatically uninstalls the bundle since only permanent packages were installed. | ||
23 | /// </summary> | ||
24 | [RuntimeFact] | ||
25 | public void DncAlwaysPreqBaDetectsInfiniteLoop() | ||
26 | { | ||
27 | var packageA = this.CreatePackageInstaller("PackageA"); | ||
28 | var packageC = this.CreatePackageInstaller("PackageC"); | ||
29 | |||
30 | var bundleC = this.CreateBundleInstaller("BundleC"); | ||
31 | |||
32 | var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs"); | ||
33 | |||
34 | // Source file should *not* be installed | ||
35 | Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}"); | ||
36 | packageC.VerifyInstalled(false); | ||
37 | |||
38 | bundleC.Install(E_PREREQBA_INFINITE_LOOP, "CAUSEINFINITELOOP=1"); | ||
39 | |||
40 | // Part of the test is Install actually completing. | ||
41 | |||
42 | // Source file should be installed | ||
43 | Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled)); | ||
44 | packageC.VerifyInstalled(false); | ||
45 | |||
46 | // No non-permanent packages should have ended up installed or cached so it should have unregistered. | ||
47 | bundleC.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
48 | } | ||
49 | |||
50 | /// <summary> | ||
51 | /// This bundle purposely provides a .runtimeconfig.json file that requires a version of .NET Core that doesn't exist, | ||
52 | /// with an MSI package to represent the prerequisite package. | ||
53 | /// This verifies that: | ||
21 | /// The preqba doesn't infinitely reload itself after failing to load the managed BA. | 54 | /// The preqba doesn't infinitely reload itself after failing to load the managed BA. |
22 | /// The engine automatically uninstalls the bundle since only permanent packages were installed. | 55 | /// The engine automatically uninstalls the bundle since only permanent packages were installed. |
23 | /// </summary> | 56 | /// </summary> |
@@ -25,7 +58,7 @@ namespace WixToolsetTest.BurnE2E | |||
25 | public void DncPreqBaDetectsInfiniteLoop() | 58 | public void DncPreqBaDetectsInfiniteLoop() |
26 | { | 59 | { |
27 | var packageA = this.CreatePackageInstaller("PackageA"); | 60 | var packageA = this.CreatePackageInstaller("PackageA"); |
28 | this.CreatePackageInstaller("PackageF"); | 61 | var packageC = this.CreatePackageInstaller("PackageC"); |
29 | 62 | ||
30 | var bundleA = this.CreateBundleInstaller("BundleA"); | 63 | var bundleA = this.CreateBundleInstaller("BundleA"); |
31 | 64 | ||
@@ -33,19 +66,132 @@ namespace WixToolsetTest.BurnE2E | |||
33 | 66 | ||
34 | // Source file should *not* be installed | 67 | // Source file should *not* be installed |
35 | Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}"); | 68 | Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}"); |
69 | packageC.VerifyInstalled(false); | ||
36 | 70 | ||
37 | bundleA.Install(E_PREREQBA_INFINITE_LOOP); | 71 | bundleA.Install(E_PREREQBA_INFINITE_LOOP, "CAUSEINFINITELOOP=1"); |
38 | 72 | ||
39 | // Part of the test is Install actually completing. | 73 | // Part of the test is Install actually completing. |
40 | 74 | ||
41 | // Source file should be installed | 75 | // Source file should be installed |
42 | Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled)); | 76 | Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled)); |
77 | packageC.VerifyInstalled(false); | ||
43 | 78 | ||
44 | // No non-permanent packages should have ended up installed or cached so it should have unregistered. | 79 | // No non-permanent packages should have ended up installed or cached so it should have unregistered. |
45 | bundleA.VerifyUnregisteredAndRemovedFromPackageCache(); | 80 | bundleA.VerifyUnregisteredAndRemovedFromPackageCache(); |
46 | } | 81 | } |
47 | 82 | ||
48 | /// <summary> | 83 | /// <summary> |
84 | /// This bundle purposely provides a .runtimeconfig.json file that requires a version of .NET Core that doesn't exist, | ||
85 | /// with an EXE prereq package to swap it out with a good one. | ||
86 | /// This verifies that: | ||
87 | /// The preqba doesn't infinitely try to install prereqs. | ||
88 | /// The managed BA gets loaded after installing prereqs. | ||
89 | /// </summary> | ||
90 | [RuntimeFact] | ||
91 | public void DncAlwaysPreqBaLoadsManagedBaAfterInstallingPrereqs() | ||
92 | { | ||
93 | var packageA = this.CreatePackageInstaller("PackageA"); | ||
94 | var packageC = this.CreatePackageInstaller("PackageC"); | ||
95 | |||
96 | var bundleC = this.CreateBundleInstaller("BundleC"); | ||
97 | |||
98 | var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs"); | ||
99 | |||
100 | // Source file should *not* be installed | ||
101 | Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}"); | ||
102 | packageC.VerifyInstalled(false); | ||
103 | |||
104 | bundleC.Install(); | ||
105 | |||
106 | // Source file should be installed | ||
107 | Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled)); | ||
108 | packageC.VerifyInstalled(true); | ||
109 | |||
110 | bundleC.VerifyRegisteredAndInPackageCache(); | ||
111 | |||
112 | bundleC.Uninstall(); | ||
113 | |||
114 | bundleC.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
115 | } | ||
116 | |||
117 | /// <summary> | ||
118 | /// This bundle purposely provides a .runtimeconfig.json file that requires a version of .NET Core that doesn't exist, | ||
119 | /// with an EXE prereq package to swap it out with a good one. | ||
120 | /// This verifies that: | ||
121 | /// The preqba doesn't infinitely reload itself after failing to load the managed BA. | ||
122 | /// The managed BA gets loaded after installing prereqs. | ||
123 | /// </summary> | ||
124 | [RuntimeFact] | ||
125 | public void DncPreqBaLoadsManagedBaAfterInstallingPrereqs() | ||
126 | { | ||
127 | var packageA = this.CreatePackageInstaller("PackageA"); | ||
128 | var packageC = this.CreatePackageInstaller("PackageC"); | ||
129 | |||
130 | var bundleA = this.CreateBundleInstaller("BundleA"); | ||
131 | |||
132 | var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs"); | ||
133 | |||
134 | // Source file should *not* be installed | ||
135 | Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}"); | ||
136 | packageC.VerifyInstalled(false); | ||
137 | |||
138 | bundleA.Install(); | ||
139 | |||
140 | // Source file should be installed | ||
141 | Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled)); | ||
142 | packageC.VerifyInstalled(true); | ||
143 | |||
144 | bundleA.VerifyRegisteredAndInPackageCache(); | ||
145 | |||
146 | bundleA.Uninstall(); | ||
147 | |||
148 | bundleA.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
149 | } | ||
150 | |||
151 | [RuntimeFact] | ||
152 | public void DncAlwaysPreqBaForwardsHelpToManagedBa() | ||
153 | { | ||
154 | var bundleE = this.CreateBundleInstaller("BundleE"); | ||
155 | |||
156 | var bundleLog = bundleE.Help(); | ||
157 | |||
158 | Assert.True(LogVerifier.MessageInLogFile(bundleLog, "This is a BA for automated testing")); | ||
159 | } | ||
160 | |||
161 | /// <summary> | ||
162 | /// This bundle purposely provides a WixToolset.Mba.Host.config file that requires a version of .NET Framework that doesn't exist, | ||
163 | /// with an MSI package to represent the prerequisite package. | ||
164 | /// This verifies that: | ||
165 | /// The preqba doesn't infinitely try to install prereqs. | ||
166 | /// The engine automatically uninstalls the bundle since only permanent packages were installed. | ||
167 | /// </summary> | ||
168 | [RuntimeFact] | ||
169 | public void MbaAlwaysPreqBaDetectsInfiniteLoop() | ||
170 | { | ||
171 | var packageB = this.CreatePackageInstaller("PackageB"); | ||
172 | var packageC = this.CreatePackageInstaller("PackageC"); | ||
173 | |||
174 | var bundleD = this.CreateBundleInstaller("BundleD"); | ||
175 | |||
176 | var packageBSourceCodeInstalled = packageB.GetInstalledFilePath("Package.wxs"); | ||
177 | |||
178 | // Source file should *not* be installed | ||
179 | Assert.False(File.Exists(packageBSourceCodeInstalled), $"Package B payload should not be there on test start: {packageBSourceCodeInstalled}"); | ||
180 | packageC.VerifyInstalled(false); | ||
181 | |||
182 | bundleD.Install(E_PREREQBA_INFINITE_LOOP, "CAUSEINFINITELOOP=1"); | ||
183 | |||
184 | // Part of the test is Install actually completing. | ||
185 | |||
186 | // Source file should be installed | ||
187 | Assert.True(File.Exists(packageBSourceCodeInstalled), String.Concat("Should have found Package B payload installed at: ", packageBSourceCodeInstalled)); | ||
188 | packageC.VerifyInstalled(false); | ||
189 | |||
190 | // No non-permanent packages should have ended up installed or cached so it should have unregistered. | ||
191 | bundleD.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
192 | } | ||
193 | |||
194 | /// <summary> | ||
49 | /// This bundle purposely provides a WixToolset.Mba.Host.config file that requires a version of .NET Framework that doesn't exist, | 195 | /// This bundle purposely provides a WixToolset.Mba.Host.config file that requires a version of .NET Framework that doesn't exist, |
50 | /// with an MSI package to represent the prerequisite package. | 196 | /// with an MSI package to represent the prerequisite package. |
51 | /// This verifies that: | 197 | /// This verifies that: |
@@ -56,7 +202,7 @@ namespace WixToolsetTest.BurnE2E | |||
56 | public void MbaPreqBaDetectsInfiniteLoop() | 202 | public void MbaPreqBaDetectsInfiniteLoop() |
57 | { | 203 | { |
58 | var packageB = this.CreatePackageInstaller("PackageB"); | 204 | var packageB = this.CreatePackageInstaller("PackageB"); |
59 | this.CreatePackageInstaller("PackageF"); | 205 | var packageC = this.CreatePackageInstaller("PackageC"); |
60 | 206 | ||
61 | var bundleB = this.CreateBundleInstaller("BundleB"); | 207 | var bundleB = this.CreateBundleInstaller("BundleB"); |
62 | 208 | ||
@@ -64,13 +210,84 @@ namespace WixToolsetTest.BurnE2E | |||
64 | 210 | ||
65 | // Source file should *not* be installed | 211 | // Source file should *not* be installed |
66 | Assert.False(File.Exists(packageBSourceCodeInstalled), $"Package B payload should not be there on test start: {packageBSourceCodeInstalled}"); | 212 | Assert.False(File.Exists(packageBSourceCodeInstalled), $"Package B payload should not be there on test start: {packageBSourceCodeInstalled}"); |
213 | packageC.VerifyInstalled(false); | ||
67 | 214 | ||
68 | bundleB.Install(E_PREREQBA_INFINITE_LOOP); | 215 | bundleB.Install(E_PREREQBA_INFINITE_LOOP, "CAUSEINFINITELOOP=1"); |
69 | 216 | ||
70 | // Part of the test is Install actually completing. | 217 | // Part of the test is Install actually completing. |
71 | 218 | ||
72 | // Source file should be installed | 219 | // Source file should be installed |
73 | Assert.True(File.Exists(packageBSourceCodeInstalled), String.Concat("Should have found Package B payload installed at: ", packageBSourceCodeInstalled)); | 220 | Assert.True(File.Exists(packageBSourceCodeInstalled), String.Concat("Should have found Package B payload installed at: ", packageBSourceCodeInstalled)); |
221 | packageC.VerifyInstalled(false); | ||
222 | |||
223 | // No non-permanent packages should have ended up installed or cached so it should have unregistered. | ||
224 | bundleB.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
225 | } | ||
226 | |||
227 | /// <summary> | ||
228 | /// This bundle purposely provides a WixToolset.Mba.Host.config file that requires a version of .NET Framework that doesn't exist, | ||
229 | /// with an EXE prereq package to swap it out with a good one. | ||
230 | /// This verifies that: | ||
231 | /// The preqba doesn't infinitely try to install prereqs. | ||
232 | /// The managed BA gets loaded after installing prereqs. | ||
233 | /// </summary> | ||
234 | [RuntimeFact] | ||
235 | public void MbaAlwaysPreqBaLoadsManagedBaAfterInstallingPrereqs() | ||
236 | { | ||
237 | var packageB = this.CreatePackageInstaller("PackageB"); | ||
238 | var packageC = this.CreatePackageInstaller("PackageC"); | ||
239 | |||
240 | var bundleD = this.CreateBundleInstaller("BundleD"); | ||
241 | |||
242 | var packageBSourceCodeInstalled = packageB.GetInstalledFilePath("Package.wxs"); | ||
243 | |||
244 | // Source file should *not* be installed | ||
245 | Assert.False(File.Exists(packageBSourceCodeInstalled), $"Package B payload should not be there on test start: {packageBSourceCodeInstalled}"); | ||
246 | packageC.VerifyInstalled(false); | ||
247 | |||
248 | bundleD.Install(); | ||
249 | |||
250 | // Source file should be installed | ||
251 | Assert.True(File.Exists(packageBSourceCodeInstalled), String.Concat("Should have found Package B payload installed at: ", packageBSourceCodeInstalled)); | ||
252 | packageC.VerifyInstalled(true); | ||
253 | |||
254 | bundleD.VerifyRegisteredAndInPackageCache(); | ||
255 | |||
256 | bundleD.Uninstall(); | ||
257 | |||
258 | bundleD.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
259 | } | ||
260 | |||
261 | /// <summary> | ||
262 | /// This bundle purposely provides a WixToolset.Mba.Host.config file that requires a version of .NET Framework that doesn't exist, | ||
263 | /// with an EXE prereq package to swap it out with a good one. | ||
264 | /// This verifies that: | ||
265 | /// The preqba doesn't infinitely reload itself after failing to load the managed BA. | ||
266 | /// The managed BA gets loaded after installing prereqs. | ||
267 | /// </summary> | ||
268 | [RuntimeFact] | ||
269 | public void MbaPreqBaLoadsManagedBaAfterInstallingPrereqs() | ||
270 | { | ||
271 | var packageB = this.CreatePackageInstaller("PackageB"); | ||
272 | var packageC = this.CreatePackageInstaller("PackageC"); | ||
273 | |||
274 | var bundleB = this.CreateBundleInstaller("BundleB"); | ||
275 | |||
276 | var packageBSourceCodeInstalled = packageB.GetInstalledFilePath("Package.wxs"); | ||
277 | |||
278 | // Source file should *not* be installed | ||
279 | Assert.False(File.Exists(packageBSourceCodeInstalled), $"Package B payload should not be there on test start: {packageBSourceCodeInstalled}"); | ||
280 | packageC.VerifyInstalled(false); | ||
281 | |||
282 | bundleB.Install(); | ||
283 | |||
284 | // Source file should be installed | ||
285 | Assert.True(File.Exists(packageBSourceCodeInstalled), String.Concat("Should have found Package B payload installed at: ", packageBSourceCodeInstalled)); | ||
286 | packageC.VerifyInstalled(true); | ||
287 | |||
288 | bundleB.VerifyRegisteredAndInPackageCache(); | ||
289 | |||
290 | bundleB.Uninstall(); | ||
74 | 291 | ||
75 | // No non-permanent packages should have ended up installed or cached so it should have unregistered. | 292 | // No non-permanent packages should have ended up installed or cached so it should have unregistered. |
76 | bundleB.VerifyUnregisteredAndRemovedFromPackageCache(); | 293 | bundleB.VerifyUnregisteredAndRemovedFromPackageCache(); |