diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-01-27 20:16:39 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-01-27 21:01:35 -0600 |
commit | 347d22f5d5e17bf020fc0c99f1e121e77fcc805c (patch) | |
tree | 754bcd24c7e738e60e9d96e74961166baf2a32d5 /src | |
parent | 41f239fb378f8371e10805c3b186ae79d734e4d4 (diff) | |
download | wix-347d22f5d5e17bf020fc0c99f1e121e77fcc805c.tar.gz wix-347d22f5d5e17bf020fc0c99f1e121e77fcc805c.tar.bz2 wix-347d22f5d5e17bf020fc0c99f1e121e77fcc805c.zip |
Port the patch tests from the old repo.
Diffstat (limited to 'src')
22 files changed, 387 insertions, 12 deletions
diff --git a/src/TestData/PatchTests/BundleA/BundleA.wixproj b/src/TestData/PatchTests/BundleA/BundleA.wixproj new file mode 100644 index 00000000..bbdace55 --- /dev/null +++ b/src/TestData/PatchTests/BundleA/BundleA.wixproj | |||
@@ -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 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <PropertyGroup> | ||
4 | <OutputType>Bundle</OutputType> | ||
5 | <UpgradeCode>{486FC795-69A5-4130-8727-4068F645A0A1}</UpgradeCode> | ||
6 | </PropertyGroup> | ||
7 | <ItemGroup> | ||
8 | <Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" /> | ||
9 | </ItemGroup> | ||
10 | <ItemGroup> | ||
11 | <ProjectReference Include="..\PackageAv1\PackageAv1.wixproj" /> | ||
12 | <ProjectReference Include="..\..\TestBA\TestBAWixlib\testbawixlib.wixproj" /> | ||
13 | </ItemGroup> | ||
14 | <ItemGroup> | ||
15 | <PackageReference Include="WixToolset.Bal.wixext" Version="4.0.81" /> | ||
16 | <PackageReference Include="WixToolset.NetFx.wixext" Version="4.0.57" /> | ||
17 | </ItemGroup> | ||
18 | </Project> \ No newline at end of file | ||
diff --git a/src/TestData/PatchTests/BundleA/BundleA.wxs b/src/TestData/PatchTests/BundleA/BundleA.wxs new file mode 100644 index 00000000..d40351a1 --- /dev/null +++ b/src/TestData/PatchTests/BundleA/BundleA.wxs | |||
@@ -0,0 +1,11 @@ | |||
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 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:swid="http://wixtoolset.org/schemas/v4/wxs/tag"> | ||
4 | <Fragment> | ||
5 | <PackageGroup Id="BundlePackages"> | ||
6 | <MsiPackage Id="PackageA" SourceFile="$(var.PackageAv1.TargetPath)" /> | ||
7 | </PackageGroup> | ||
8 | |||
9 | <!--<swid:Tag Regid="regid.1995-08.com.example" />--> | ||
10 | </Fragment> | ||
11 | </Wix> | ||
diff --git a/src/TestData/PatchTests/BundlePatchA/BundlePatchA.wixproj b/src/TestData/PatchTests/BundlePatchA/BundlePatchA.wixproj new file mode 100644 index 00000000..5846fce5 --- /dev/null +++ b/src/TestData/PatchTests/BundlePatchA/BundlePatchA.wixproj | |||
@@ -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 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <PropertyGroup> | ||
4 | <OutputType>Bundle</OutputType> | ||
5 | <UpgradeCode>{AA083618-6280-44B8-9899-57BCC57906A5}</UpgradeCode> | ||
6 | </PropertyGroup> | ||
7 | <ItemGroup> | ||
8 | <Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" /> | ||
9 | </ItemGroup> | ||
10 | <ItemGroup> | ||
11 | <ProjectReference Include="..\PatchA\PatchA.wixproj" /> | ||
12 | <ProjectReference Include="..\..\TestBA\TestBAWixlib\testbawixlib.wixproj" /> | ||
13 | </ItemGroup> | ||
14 | <ItemGroup> | ||
15 | <PackageReference Include="WixToolset.Bal.wixext" Version="4.0.81" /> | ||
16 | <PackageReference Include="WixToolset.NetFx.wixext" Version="4.0.57" /> | ||
17 | </ItemGroup> | ||
18 | </Project> \ No newline at end of file | ||
diff --git a/src/TestData/PatchTests/BundlePatchA/BundlePatchA.wxs b/src/TestData/PatchTests/BundlePatchA/BundlePatchA.wxs new file mode 100644 index 00000000..89f24936 --- /dev/null +++ b/src/TestData/PatchTests/BundlePatchA/BundlePatchA.wxs | |||
@@ -0,0 +1,11 @@ | |||
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 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:swid="http://wixtoolset.org/schemas/v4/wxs/tag"> | ||
4 | <Fragment> | ||
5 | <PackageGroup Id="BundlePackages"> | ||
6 | <MspPackage Id="PatchA" SourceFile="$(var.PatchA.TargetPath)" PerMachine="yes" /> | ||
7 | </PackageGroup> | ||
8 | |||
9 | <!--<swid:Tag Regid="regid.1995-08.com.example" Type="patch" />--> | ||
10 | </Fragment> | ||
11 | </Wix> | ||
diff --git a/src/TestData/PatchTests/BundlePatchA2/BundlePatchA2.wixproj b/src/TestData/PatchTests/BundlePatchA2/BundlePatchA2.wixproj new file mode 100644 index 00000000..dee4a0f3 --- /dev/null +++ b/src/TestData/PatchTests/BundlePatchA2/BundlePatchA2.wixproj | |||
@@ -0,0 +1,19 @@ | |||
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 | <UpgradeCode>{1BE09331-2327-4534-9223-59B54EFAE7A5}</UpgradeCode> | ||
6 | </PropertyGroup> | ||
7 | <ItemGroup> | ||
8 | <Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" /> | ||
9 | </ItemGroup> | ||
10 | <ItemGroup> | ||
11 | <ProjectReference Include="..\PatchA\PatchA.wixproj" /> | ||
12 | <ProjectReference Include="..\PatchA2\PatchA2.wixproj" /> | ||
13 | <ProjectReference Include="..\..\TestBA\TestBAWixlib\testbawixlib.wixproj" /> | ||
14 | </ItemGroup> | ||
15 | <ItemGroup> | ||
16 | <PackageReference Include="WixToolset.Bal.wixext" Version="4.0.81" /> | ||
17 | <PackageReference Include="WixToolset.NetFx.wixext" Version="4.0.57" /> | ||
18 | </ItemGroup> | ||
19 | </Project> \ No newline at end of file | ||
diff --git a/src/TestData/PatchTests/BundlePatchA2/BundlePatchA2.wxs b/src/TestData/PatchTests/BundlePatchA2/BundlePatchA2.wxs new file mode 100644 index 00000000..f2c44ad4 --- /dev/null +++ b/src/TestData/PatchTests/BundlePatchA2/BundlePatchA2.wxs | |||
@@ -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 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:swid="http://wixtoolset.org/schemas/v4/wxs/tag"> | ||
4 | <Fragment> | ||
5 | <PackageGroup Id="BundlePackages"> | ||
6 | <MspPackage Id="PatchA" SourceFile="$(var.PatchA.TargetPath)" PerMachine="yes" /> | ||
7 | <MspPackage Id="PatchA2" SourceFile="$(var.PatchA2.TargetPath)" PerMachine="yes" /> | ||
8 | </PackageGroup> | ||
9 | |||
10 | <!--<swid:Tag Regid="regid.1995-08.com.example" Type="patch" />--> | ||
11 | </Fragment> | ||
12 | </Wix> | ||
diff --git a/src/TestData/PatchTests/PackageAv1/PackageA.props b/src/TestData/PatchTests/PackageAv1/PackageA.props new file mode 100644 index 00000000..1209d09e --- /dev/null +++ b/src/TestData/PatchTests/PackageAv1/PackageA.props | |||
@@ -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 | <Project> | ||
3 | <PropertyGroup> | ||
4 | <PackageName>PackageA</PackageName> | ||
5 | <ProductComponentsRef>true</ProductComponentsRef> | ||
6 | <ProductCode>{724F9BA5-DD9D-4851-855E-ECC35B27BF11}</ProductCode> | ||
7 | <UpgradeCode>{C56DA396-7A9A-4177-8264-638161CE9EB8}</UpgradeCode> | ||
8 | </PropertyGroup> | ||
9 | <ItemGroup> | ||
10 | <Compile Include="..\..\Templates\Package.wxs" Link="Package.wxs" /> | ||
11 | </ItemGroup> | ||
12 | </Project> \ No newline at end of file | ||
diff --git a/src/TestData/PatchTests/PackageAv1/PackageAv1.wixproj b/src/TestData/PatchTests/PackageAv1/PackageAv1.wixproj new file mode 100644 index 00000000..45d3b2c8 --- /dev/null +++ b/src/TestData/PatchTests/PackageAv1/PackageAv1.wixproj | |||
@@ -0,0 +1,4 @@ | |||
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 | <Import Project="PackageA.props" /> | ||
4 | </Project> \ No newline at end of file | ||
diff --git a/src/TestData/PatchTests/PackageAv1/ProductComponents.wxs b/src/TestData/PatchTests/PackageAv1/ProductComponents.wxs new file mode 100644 index 00000000..81c6da0c --- /dev/null +++ b/src/TestData/PatchTests/PackageAv1/ProductComponents.wxs | |||
@@ -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 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:swid="http://wixtoolset.org/schemas/v4/wxs/tag"> | ||
4 | <Fragment> | ||
5 | <ComponentGroup Id="ProductComponents"> | ||
6 | <ComponentRef Id="RegistryComponent2" /> | ||
7 | </ComponentGroup> | ||
8 | |||
9 | <!-- <swid:Tag Regid="regid.1995-08.com.example" /> --> | ||
10 | </Fragment> | ||
11 | |||
12 | <Fragment> | ||
13 | <Component Id="RegistryComponent2" Directory="INSTALLFOLDER"> | ||
14 | <RegistryValue Root="HKLM" Key="Software\WiX\Tests\$(var.TestGroupName)" Name="$(var.PackageName)2" Value="!(bind.Property.TestVersion)" Type="string" /> | ||
15 | </Component> | ||
16 | </Fragment> | ||
17 | </Wix> | ||
diff --git a/src/TestData/PatchTests/PackageAv1_0_1/PackageAv1_0_1.wixproj b/src/TestData/PatchTests/PackageAv1_0_1/PackageAv1_0_1.wixproj new file mode 100644 index 00000000..9ceda117 --- /dev/null +++ b/src/TestData/PatchTests/PackageAv1_0_1/PackageAv1_0_1.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 | <Import Project="..\PackageAv1\PackageA.props" /> | ||
4 | <PropertyGroup> | ||
5 | <Version>1.0.1.0</Version> | ||
6 | </PropertyGroup> | ||
7 | <ItemGroup> | ||
8 | <Compile Include="..\PackageAv1\ProductComponents.wxs" Link="ProductComponents.wxs" /> | ||
9 | </ItemGroup> | ||
10 | </Project> \ No newline at end of file | ||
diff --git a/src/TestData/PatchTests/PatchA/PatchA.wixproj b/src/TestData/PatchTests/PatchA/PatchA.wixproj new file mode 100644 index 00000000..da9acb5e --- /dev/null +++ b/src/TestData/PatchTests/PatchA/PatchA.wixproj | |||
@@ -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 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <PropertyGroup> | ||
4 | <OutputType>PatchCreation</OutputType> | ||
5 | <TargetExt>.msp</TargetExt> | ||
6 | <SuppressSpecificWarnings>1079</SuppressSpecificWarnings> | ||
7 | </PropertyGroup> | ||
8 | <ItemGroup> | ||
9 | <ProjectReference Include="..\PackageAv1\PackageAv1.wixproj" /> | ||
10 | <ProjectReference Include="..\PackageAv1_0_1\PackageAv1_0_1.wixproj" /> | ||
11 | </ItemGroup> | ||
12 | </Project> \ No newline at end of file | ||
diff --git a/src/TestData/PatchTests/PatchA/PatchA.wxs b/src/TestData/PatchTests/PatchA/PatchA.wxs new file mode 100644 index 00000000..067f25ca --- /dev/null +++ b/src/TestData/PatchTests/PatchA/PatchA.wxs | |||
@@ -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 | |||
3 | <?ifndef Version?> | ||
4 | <?define Version = 1.0.0.0?> | ||
5 | <?endif?> | ||
6 | |||
7 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:swid="http://wixtoolset.org/schemas/v4/wxs/tag"> | ||
8 | <Patch AllowRemoval="yes" Classification="Update" Description="Patch A in test $(var.TestGroupName)" DisplayName="$(var.TestGroupName) - Patch A" Manufacturer="Example Corporation" MinorUpdateTargetRTM="yes"> | ||
9 | <Media Id="100" Cabinet="PatchA" EmbedCab="yes"> | ||
10 | <PatchBaseline | ||
11 | Id="PatchA" | ||
12 | BaselineFile="$(var.PackageAv1.TargetDir)$(var.PackageAv1.TargetName).wixpdb" | ||
13 | UpdateFile="$(var.PackageAv1_0_1.TargetDir)$(var.PackageAv1_0_1.TargetName).wixpdb" | ||
14 | /> | ||
15 | </Media> | ||
16 | |||
17 | <PatchFamily Id="A" Version="$(var.Version)" Supersede="yes"> | ||
18 | <!-- <swid:TagRef Regid="regid.1995-08.com.example" /> --> | ||
19 | |||
20 | <ComponentRef Id="RegistryComponent"/> | ||
21 | <PropertyRef Id="TestVersion"/> | ||
22 | </PatchFamily> | ||
23 | </Patch> | ||
24 | </Wix> | ||
diff --git a/src/TestData/PatchTests/PatchA2/PatchA2.wixproj b/src/TestData/PatchTests/PatchA2/PatchA2.wixproj new file mode 100644 index 00000000..da9acb5e --- /dev/null +++ b/src/TestData/PatchTests/PatchA2/PatchA2.wixproj | |||
@@ -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 | <Project Sdk="WixToolset.Sdk"> | ||
3 | <PropertyGroup> | ||
4 | <OutputType>PatchCreation</OutputType> | ||
5 | <TargetExt>.msp</TargetExt> | ||
6 | <SuppressSpecificWarnings>1079</SuppressSpecificWarnings> | ||
7 | </PropertyGroup> | ||
8 | <ItemGroup> | ||
9 | <ProjectReference Include="..\PackageAv1\PackageAv1.wixproj" /> | ||
10 | <ProjectReference Include="..\PackageAv1_0_1\PackageAv1_0_1.wixproj" /> | ||
11 | </ItemGroup> | ||
12 | </Project> \ No newline at end of file | ||
diff --git a/src/TestData/PatchTests/PatchA2/PatchA2.wxs b/src/TestData/PatchTests/PatchA2/PatchA2.wxs new file mode 100644 index 00000000..a06401cc --- /dev/null +++ b/src/TestData/PatchTests/PatchA2/PatchA2.wxs | |||
@@ -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 | <?ifndef Version?> | ||
4 | <?define Version = 1.0.0.0?> | ||
5 | <?endif?> | ||
6 | |||
7 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:swid="http://wixtoolset.org/schemas/v4/wxs/tag"> | ||
8 | <Patch AllowRemoval="yes" Classification="Update" Description="Patch A2 in test $(var.TestGroupName)" DisplayName="$(var.TestGroupName) - Patch A2" Manufacturer="Example Corporation" MinorUpdateTargetRTM="yes"> | ||
9 | <Media Id="100" Cabinet="PatchA2" EmbedCab="yes"> | ||
10 | <PatchBaseline | ||
11 | Id="PatchA2" | ||
12 | BaselineFile="$(var.PackageAv1.TargetDir)$(var.PackageAv1.TargetName).wixpdb" | ||
13 | UpdateFile="$(var.PackageAv1_0_1.TargetDir)$(var.PackageAv1_0_1.TargetName).wixpdb" | ||
14 | /> | ||
15 | </Media> | ||
16 | |||
17 | <PatchFamily Id="A2" Version="$(var.Version)" Supersede="yes"> | ||
18 | <!-- <swid:TagRef Regid="regid.1995-08.com.example" /> --> | ||
19 | |||
20 | <ComponentRef Id="RegistryComponent2"/> | ||
21 | </PatchFamily> | ||
22 | </Patch> | ||
23 | </Wix> | ||
diff --git a/src/TestData/Templates/Package.wxs b/src/TestData/Templates/Package.wxs index 5522b9a3..4923e1aa 100644 --- a/src/TestData/Templates/Package.wxs +++ b/src/TestData/Templates/Package.wxs | |||
@@ -6,8 +6,12 @@ | |||
6 | <?define Version = 1.0.0.0?> | 6 | <?define Version = 1.0.0.0?> |
7 | <?endif?> | 7 | <?endif?> |
8 | 8 | ||
9 | <?ifndef ProductCode?> | ||
10 | <?define ProductCode = *?> | ||
11 | <?endif?> | ||
12 | |||
9 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | 13 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> |
10 | <Package Name="~$(var.TestGroupName) - $(var.PackageName)" Language="1033" Version="$(var.Version)" Manufacturer="Microsoft Corporation" UpgradeCode="$(var.UpgradeCode)" Compressed="yes"> | 14 | <Package Name="~$(var.TestGroupName) - $(var.PackageName)" Language="1033" Version="$(var.Version)" Manufacturer="Microsoft Corporation" UpgradeCode="$(var.UpgradeCode)" Compressed="yes" ProductCode="$(var.ProductCode)"> |
11 | <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> | 15 | <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> |
12 | <?ifndef CabPrefix?> | 16 | <?ifndef CabPrefix?> |
13 | <MediaTemplate EmbedCab="yes" /> | 17 | <MediaTemplate EmbedCab="yes" /> |
@@ -20,6 +24,9 @@ | |||
20 | <Feature Id="Complete" Level="1"> | 24 | <Feature Id="Complete" Level="1"> |
21 | <ComponentRef Id="FileComponent" /> | 25 | <ComponentRef Id="FileComponent" /> |
22 | <ComponentRef Id="RegistryComponent" /> | 26 | <ComponentRef Id="RegistryComponent" /> |
27 | <?ifdef var.ProductComponents?> | ||
28 | <ComponentGroupRef Id="ProductComponents" /> | ||
29 | <?endif?> | ||
23 | </Feature> | 30 | </Feature> |
24 | </Package> | 31 | </Package> |
25 | 32 | ||
diff --git a/src/Wix.Build.targets b/src/Wix.Build.targets index e6018b67..3fe78ae3 100644 --- a/src/Wix.Build.targets +++ b/src/Wix.Build.targets | |||
@@ -7,6 +7,8 @@ | |||
7 | <DefineConstants>TestGroupName=$(TestGroupName);PackageName=$(PackageName);BundleName=$(BundleName);$(DefineConstants)</DefineConstants> | 7 | <DefineConstants>TestGroupName=$(TestGroupName);PackageName=$(PackageName);BundleName=$(BundleName);$(DefineConstants)</DefineConstants> |
8 | <DefineConstants Condition=" '$(BA)' != '' ">BA=$(BA);$(DefineConstants)</DefineConstants> | 8 | <DefineConstants Condition=" '$(BA)' != '' ">BA=$(BA);$(DefineConstants)</DefineConstants> |
9 | <DefineConstants Condition=" '$(CabPrefix)' != '' ">CabPrefix=$(CabPrefix);$(DefineConstants)</DefineConstants> | 9 | <DefineConstants Condition=" '$(CabPrefix)' != '' ">CabPrefix=$(CabPrefix);$(DefineConstants)</DefineConstants> |
10 | <DefineConstants Condition=" '$(ProductCode)' != '' ">ProductCode=$(ProductCode);$(DefineConstants)</DefineConstants> | ||
11 | <DefineConstants Condition=" '$(ProductComponentsRef)' == 'true' ">ProductComponents=1;$(DefineConstants)</DefineConstants> | ||
10 | <DefineConstants Condition=" '$(UpgradeCode)' != '' ">UpgradeCode=$(UpgradeCode);$(DefineConstants)</DefineConstants> | 12 | <DefineConstants Condition=" '$(UpgradeCode)' != '' ">UpgradeCode=$(UpgradeCode);$(DefineConstants)</DefineConstants> |
11 | <DefineConstants Condition=" '$(Version)' != '' ">Version=$(Version);$(DefineConstants)</DefineConstants> | 13 | <DefineConstants Condition=" '$(Version)' != '' ">Version=$(Version);$(DefineConstants)</DefineConstants> |
12 | </PropertyGroup> | 14 | </PropertyGroup> |
diff --git a/src/WixToolsetTest.BurnE2E/BurnE2ETests.cs b/src/WixToolsetTest.BurnE2E/BurnE2ETests.cs index 8d1cca23..f3b3e583 100644 --- a/src/WixToolsetTest.BurnE2E/BurnE2ETests.cs +++ b/src/WixToolsetTest.BurnE2E/BurnE2ETests.cs | |||
@@ -21,9 +21,9 @@ namespace WixToolsetTest.BurnE2E | |||
21 | return installer; | 21 | return installer; |
22 | } | 22 | } |
23 | 23 | ||
24 | protected PackageInstaller CreatePackageInstaller(string name) | 24 | protected PackageInstaller CreatePackageInstaller(string filename) |
25 | { | 25 | { |
26 | var installer = new PackageInstaller(this.TestContext, name); | 26 | var installer = new PackageInstaller(this.TestContext, filename); |
27 | this.Installers.Enqueue(installer); | 27 | this.Installers.Enqueue(installer); |
28 | return installer; | 28 | return installer; |
29 | } | 29 | } |
diff --git a/src/WixToolsetTest.BurnE2E/PackageInstaller.cs b/src/WixToolsetTest.BurnE2E/PackageInstaller.cs index 95d6cd90..bd1e30cc 100644 --- a/src/WixToolsetTest.BurnE2E/PackageInstaller.cs +++ b/src/WixToolsetTest.BurnE2E/PackageInstaller.cs | |||
@@ -8,11 +8,10 @@ namespace WixToolsetTest.BurnE2E | |||
8 | 8 | ||
9 | public partial class PackageInstaller : IDisposable | 9 | public partial class PackageInstaller : IDisposable |
10 | { | 10 | { |
11 | public PackageInstaller(WixTestContext testContext, string name) | 11 | public PackageInstaller(WixTestContext testContext, string filename) |
12 | { | 12 | { |
13 | this.Package = Path.Combine(testContext.TestDataFolder, $"{name}.msi"); | 13 | this.Package = Path.Combine(testContext.TestDataFolder, $"{filename}.msi"); |
14 | this.PackagePdb = Path.Combine(testContext.TestDataFolder, $"{name}.wixpdb"); | 14 | this.PackagePdb = Path.Combine(testContext.TestDataFolder, $"{filename}.wixpdb"); |
15 | this.PackageName = name; | ||
16 | this.TestContext = testContext; | 15 | this.TestContext = testContext; |
17 | } | 16 | } |
18 | 17 | ||
diff --git a/src/WixToolsetTest.BurnE2E/PackageVerifier.cs b/src/WixToolsetTest.BurnE2E/PackageVerifier.cs index 7b4bbfef..7a4fea88 100644 --- a/src/WixToolsetTest.BurnE2E/PackageVerifier.cs +++ b/src/WixToolsetTest.BurnE2E/PackageVerifier.cs | |||
@@ -12,15 +12,13 @@ namespace WixToolsetTest.BurnE2E | |||
12 | 12 | ||
13 | public partial class PackageInstaller | 13 | public partial class PackageInstaller |
14 | { | 14 | { |
15 | private string PackageName { get; } | ||
16 | |||
17 | public string PackagePdb { get; } | 15 | public string PackagePdb { get; } |
18 | 16 | ||
19 | private WindowsInstallerData WiData { get; set; } | 17 | private WindowsInstallerData WiData { get; set; } |
20 | 18 | ||
21 | public string GetInstalledFilePath(string filename) | 19 | public string GetInstalledFilePath(string filename) |
22 | { | 20 | { |
23 | return this.TestContext.GetTestInstallFolder(Path.Combine(this.PackageName, filename)); | 21 | return this.TestContext.GetTestInstallFolder(Path.Combine(this.GetInstallFolderName(), filename)); |
24 | } | 22 | } |
25 | 23 | ||
26 | private WindowsInstallerData GetWindowsInstallerData() | 24 | private WindowsInstallerData GetWindowsInstallerData() |
@@ -34,6 +32,19 @@ namespace WixToolsetTest.BurnE2E | |||
34 | return this.WiData; | 32 | return this.WiData; |
35 | } | 33 | } |
36 | 34 | ||
35 | public string GetInstallFolderName() | ||
36 | { | ||
37 | var wiData = this.GetWindowsInstallerData(); | ||
38 | var row = wiData.Tables["Directory"].Rows.Single(r => r.FieldAsString(0) == "INSTALLFOLDER"); | ||
39 | var value = row.FieldAsString(2); | ||
40 | var longNameIndex = value.IndexOf('|') + 1; | ||
41 | if (longNameIndex > 0) | ||
42 | { | ||
43 | return value.Substring(longNameIndex); | ||
44 | } | ||
45 | return value; | ||
46 | } | ||
47 | |||
37 | public string GetProperty(string name) | 48 | public string GetProperty(string name) |
38 | { | 49 | { |
39 | var wiData = this.GetWindowsInstallerData(); | 50 | var wiData = this.GetWindowsInstallerData(); |
@@ -46,5 +57,21 @@ namespace WixToolsetTest.BurnE2E | |||
46 | var productCode = this.GetProperty("ProductCode"); | 57 | var productCode = this.GetProperty("ProductCode"); |
47 | Assert.Equal(installed, MsiUtilities.IsProductInstalled(productCode)); | 58 | Assert.Equal(installed, MsiUtilities.IsProductInstalled(productCode)); |
48 | } | 59 | } |
60 | |||
61 | public void VerifyTestRegistryRootDeleted() | ||
62 | { | ||
63 | using var testRegistryRoot = this.TestContext.GetTestRegistryRoot(); | ||
64 | Assert.Null(testRegistryRoot); | ||
65 | } | ||
66 | |||
67 | public void VerifyTestRegistryValue(string name, string expectedValue) | ||
68 | { | ||
69 | using (var root = this.TestContext.GetTestRegistryRoot()) | ||
70 | { | ||
71 | Assert.NotNull(root); | ||
72 | var actualValue = root.GetValue(name) as string; | ||
73 | Assert.Equal(expectedValue, actualValue); | ||
74 | } | ||
75 | } | ||
49 | } | 76 | } |
50 | } | 77 | } |
diff --git a/src/WixToolsetTest.BurnE2E/PatchTests.cs b/src/WixToolsetTest.BurnE2E/PatchTests.cs new file mode 100644 index 00000000..19adf8db --- /dev/null +++ b/src/WixToolsetTest.BurnE2E/PatchTests.cs | |||
@@ -0,0 +1,137 @@ | |||
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 WixToolsetTest.BurnE2E | ||
4 | { | ||
5 | using System; | ||
6 | using System.IO; | ||
7 | using System.Xml; | ||
8 | using Xunit; | ||
9 | using Xunit.Abstractions; | ||
10 | |||
11 | public class PatchTests : BurnE2ETests | ||
12 | { | ||
13 | public PatchTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { } | ||
14 | |||
15 | [Fact] | ||
16 | public void CanRunDetectMultipleTimesWithPatches() | ||
17 | { | ||
18 | var testBAController = this.CreateTestBAController(); | ||
19 | testBAController.SetRedetectCount(1); | ||
20 | |||
21 | this.CanInstallBundleWithPatchThenRemoveIt(); | ||
22 | } | ||
23 | |||
24 | [Fact] | ||
25 | public void CanInstallBundleWithPatchThenRemoveIt() | ||
26 | { | ||
27 | var originalVersion = "1.0.0.0"; | ||
28 | var patchedVersion = "1.0.1.0"; | ||
29 | var testRegistryValue = "PackageA"; | ||
30 | |||
31 | var packageAv1 = this.CreatePackageInstaller("PackageAv1"); | ||
32 | var bundleA = this.CreateBundleInstaller("BundleA"); | ||
33 | var bundlePatchA = this.CreateBundleInstaller("BundlePatchA"); | ||
34 | |||
35 | bundleA.Install(); | ||
36 | bundleA.VerifyRegisteredAndInPackageCache(); | ||
37 | |||
38 | packageAv1.VerifyInstalled(true); | ||
39 | packageAv1.VerifyTestRegistryValue(testRegistryValue, originalVersion); | ||
40 | |||
41 | bundlePatchA.Install(); | ||
42 | bundlePatchA.VerifyRegisteredAndInPackageCache(); | ||
43 | |||
44 | packageAv1.VerifyTestRegistryValue(testRegistryValue, patchedVersion); | ||
45 | |||
46 | bundlePatchA.Uninstall(); | ||
47 | bundlePatchA.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
48 | |||
49 | packageAv1.VerifyTestRegistryValue(testRegistryValue, originalVersion); | ||
50 | |||
51 | bundleA.Uninstall(); | ||
52 | bundleA.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
53 | |||
54 | packageAv1.VerifyInstalled(false); | ||
55 | packageAv1.VerifyTestRegistryRootDeleted(); | ||
56 | } | ||
57 | |||
58 | [Fact(Skip = "https://github.com/wixtoolset/issues/issues/5949")] | ||
59 | public void CanPatchSwidTag() | ||
60 | { | ||
61 | var originalVersion = "1.0.0.0"; | ||
62 | var patchedVersion = "1.0.1.0"; | ||
63 | var packageTagName = "~PatchTests - PackageA"; | ||
64 | var bundleTagName = "~PatchTests - BundleA"; | ||
65 | var bundlePatchTagName = "~PatchTests - BundlePatchA"; | ||
66 | |||
67 | this.CreatePackageInstaller("PackageAv1"); | ||
68 | var bundleA = this.CreateBundleInstaller("BundleA"); | ||
69 | var bundlePatchA = this.CreateBundleInstaller("BundlePatchA"); | ||
70 | |||
71 | bundleA.Install(); | ||
72 | VerifySwidTagVersion(bundleTagName, originalVersion); | ||
73 | VerifySwidTagVersion(packageTagName, originalVersion); | ||
74 | |||
75 | bundlePatchA.Install(); | ||
76 | VerifySwidTagVersion(bundlePatchTagName, patchedVersion); | ||
77 | VerifySwidTagVersion(packageTagName, patchedVersion); | ||
78 | |||
79 | bundlePatchA.Uninstall(); | ||
80 | VerifySwidTagVersion(packageTagName, originalVersion); | ||
81 | |||
82 | bundleA.Uninstall(); | ||
83 | VerifySwidTagVersion(bundleTagName, null); | ||
84 | VerifySwidTagVersion(packageTagName, null); | ||
85 | } | ||
86 | |||
87 | [Fact] | ||
88 | public void CanInstallBundleWithPatchesTargetingSingleProductThenRemoveIt() | ||
89 | { | ||
90 | var originalVersion = "1.0.0.0"; | ||
91 | var patchedVersion = "1.0.1.0"; | ||
92 | var testRegistryValue = "PackageA"; | ||
93 | var testRegistryValue2 = "PackageA2"; | ||
94 | |||
95 | var packageAv1 = this.CreatePackageInstaller("PackageAv1"); | ||
96 | var bundlePatchA2 = this.CreateBundleInstaller("BundlePatchA2"); | ||
97 | |||
98 | packageAv1.InstallProduct(); | ||
99 | packageAv1.VerifyInstalled(true); | ||
100 | packageAv1.VerifyTestRegistryValue(testRegistryValue, originalVersion); | ||
101 | packageAv1.VerifyTestRegistryValue(testRegistryValue2, originalVersion); | ||
102 | |||
103 | bundlePatchA2.Install(); | ||
104 | bundlePatchA2.VerifyRegisteredAndInPackageCache(); | ||
105 | |||
106 | packageAv1.VerifyTestRegistryValue(testRegistryValue, patchedVersion); | ||
107 | packageAv1.VerifyTestRegistryValue(testRegistryValue2, patchedVersion); | ||
108 | |||
109 | bundlePatchA2.Uninstall(); | ||
110 | bundlePatchA2.VerifyUnregisteredAndRemovedFromPackageCache(); | ||
111 | |||
112 | packageAv1.VerifyTestRegistryValue(testRegistryValue, originalVersion); | ||
113 | packageAv1.VerifyTestRegistryValue(testRegistryValue2, originalVersion); | ||
114 | } | ||
115 | |||
116 | private static void VerifySwidTagVersion(string tagName, string expectedVersion) | ||
117 | { | ||
118 | var regidFolder = Environment.ExpandEnvironmentVariables(@"%ProgramData%\regid.1995-08.com.example"); | ||
119 | var tagPath = Path.Combine(regidFolder, "regid.1995-08.com.example " + tagName + ".swidtag"); | ||
120 | string version = null; | ||
121 | |||
122 | if (File.Exists(tagPath)) | ||
123 | { | ||
124 | var doc = new XmlDocument(); | ||
125 | doc.Load(tagPath); | ||
126 | |||
127 | var ns = new XmlNamespaceManager(doc.NameTable); | ||
128 | ns.AddNamespace("s", "http://standards.iso.org/iso/19770/-2/2009/schema.xsd"); | ||
129 | |||
130 | var versionNode = doc.SelectSingleNode("/s:software_identification_tag/s:product_version/s:name", ns); | ||
131 | version = versionNode?.InnerText ?? String.Empty; | ||
132 | } | ||
133 | |||
134 | Assert.Equal(expectedVersion, version); | ||
135 | } | ||
136 | } | ||
137 | } | ||
diff --git a/src/WixToolsetTest.BurnE2E/WixTestContext.cs b/src/WixToolsetTest.BurnE2E/WixTestContext.cs index 5620c6a7..0ae99a77 100644 --- a/src/WixToolsetTest.BurnE2E/WixTestContext.cs +++ b/src/WixToolsetTest.BurnE2E/WixTestContext.cs | |||
@@ -57,7 +57,7 @@ namespace WixToolsetTest.BurnE2E | |||
57 | /// </remarks> | 57 | /// </remarks> |
58 | public RegistryKey GetTestRegistryRoot(string additionalPath = null) | 58 | public RegistryKey GetTestRegistryRoot(string additionalPath = null) |
59 | { | 59 | { |
60 | var key = String.Format(@"Software\WiX\Tests\{0}\{1}", this.TestName, additionalPath ?? String.Empty); | 60 | var key = String.Format(@"Software\WOW6432Node\WiX\Tests\{0}\{1}", this.TestGroupName, additionalPath ?? String.Empty); |
61 | return Registry.LocalMachine.OpenSubKey(key, true); | 61 | return Registry.LocalMachine.OpenSubKey(key, true); |
62 | } | 62 | } |
63 | 63 | ||
diff --git a/src/WixToolsetTest.BurnE2E/WixToolsetTest.BurnE2E.csproj b/src/WixToolsetTest.BurnE2E/WixToolsetTest.BurnE2E.csproj index 86ad4410..3ffc892f 100644 --- a/src/WixToolsetTest.BurnE2E/WixToolsetTest.BurnE2E.csproj +++ b/src/WixToolsetTest.BurnE2E/WixToolsetTest.BurnE2E.csproj | |||
@@ -16,7 +16,7 @@ | |||
16 | <PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" /> | 16 | <PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" /> |
17 | <PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" /> | 17 | <PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" /> |
18 | <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.48" /> | 18 | <PackageReference Include="WixBuildTools.TestSupport" Version="4.0.48" /> |
19 | <PackageReference Include="WixToolset.Data" Version="4.0.180" /> | 19 | <PackageReference Include="WixToolset.Data" Version="4.0.181" /> |
20 | <PackageReference Include="WixToolset.Mba.Core" Version="4.0.47" /> | 20 | <PackageReference Include="WixToolset.Mba.Core" Version="4.0.47" /> |
21 | </ItemGroup> | 21 | </ItemGroup> |
22 | 22 | ||