Port the patch tests from the old repo.
Sean Hall committed
Jan 27, 2021 at 20:16 UTC
347d22f5d5e17bf020fc0c99f1e121e77fcc805c
23 files changed
+388
-13
global.json
+1
-1
@@ -1,6 +1,6 @@
1
{
2
"msbuild-sdks": {
3
- "WixToolset.Sdk": "4.0.0-build-0179"
3
+ "WixToolset.Sdk": "4.0.0-build-0183"
4
},
5
"sdk": {
6
"allowPrerelease": false
src/TestData/PatchTests/BundleA/BundleA.wixproj
new
+18
@@ -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
src/TestData/PatchTests/BundleA/BundleA.wxs
new
+11
@@ -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>
src/TestData/PatchTests/BundlePatchA/BundlePatchA.wixproj
new
+18
@@ -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
src/TestData/PatchTests/BundlePatchA/BundlePatchA.wxs
new
+11
@@ -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>
src/TestData/PatchTests/BundlePatchA2/BundlePatchA2.wixproj
new
+19
@@ -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
src/TestData/PatchTests/BundlePatchA2/BundlePatchA2.wxs
new
+12
@@ -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>
src/TestData/PatchTests/PackageAv1/PackageA.props
new
+12
@@ -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
src/TestData/PatchTests/PackageAv1/PackageAv1.wixproj
new
+4
@@ -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
src/TestData/PatchTests/PackageAv1/ProductComponents.wxs
new
+17
@@ -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>
src/TestData/PatchTests/PackageAv1_0_1/PackageAv1_0_1.wixproj
new
+10
@@ -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
src/TestData/PatchTests/PatchA/PatchA.wixproj
new
+12
@@ -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
src/TestData/PatchTests/PatchA/PatchA.wxs
new
+24
@@ -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>
src/TestData/PatchTests/PatchA2/PatchA2.wixproj
new
+12
@@ -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
src/TestData/PatchTests/PatchA2/PatchA2.wxs
new
+23
@@ -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>
src/TestData/Templates/Package.wxs
+8
-1
@@ -6,8 +6,12 @@
6
<?define Version = 1.0.0.0?>
7
<?endif?>
8
9
+<?ifndef ProductCode?>
10
+<?define ProductCode = *?>
11
+<?endif?>
12
+
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)">
15
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
16
<?ifndef CabPrefix?>
17
<MediaTemplate EmbedCab="yes" />
@@ -20,6 +24,9 @@
24
<Feature Id="Complete" Level="1">
25
<ComponentRef Id="FileComponent" />
26
<ComponentRef Id="RegistryComponent" />
27
+ <?ifdef var.ProductComponents?>
28
+ <ComponentGroupRef Id="ProductComponents" />
29
+ <?endif?>
30
</Feature>
31
</Package>
32
src/Wix.Build.targets
+2
@@ -7,6 +7,8 @@
7
<DefineConstants>TestGroupName=$(TestGroupName);PackageName=$(PackageName);BundleName=$(BundleName);$(DefineConstants)</DefineConstants>
8
<DefineConstants Condition=" '$(BA)' != '' ">BA=$(BA);$(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>
12
<DefineConstants Condition=" '$(UpgradeCode)' != '' ">UpgradeCode=$(UpgradeCode);$(DefineConstants)</DefineConstants>
13
<DefineConstants Condition=" '$(Version)' != '' ">Version=$(Version);$(DefineConstants)</DefineConstants>
14
</PropertyGroup>
src/WixToolsetTest.BurnE2E/BurnE2ETests.cs
+2
-2
@@ -21,9 +21,9 @@ namespace WixToolsetTest.BurnE2E
21
return installer;
22
}
23
24
- protected PackageInstaller CreatePackageInstaller(string name)
24
+ protected PackageInstaller CreatePackageInstaller(string filename)
25
{
26
- var installer = new PackageInstaller(this.TestContext, name);
26
+ var installer = new PackageInstaller(this.TestContext, filename);
27
this.Installers.Enqueue(installer);
28
return installer;
29
}
src/WixToolsetTest.BurnE2E/PackageInstaller.cs
+3
-4
@@ -8,11 +8,10 @@ namespace WixToolsetTest.BurnE2E
8
9
public partial class PackageInstaller : IDisposable
10
{
11
- public PackageInstaller(WixTestContext testContext, string name)
11
+ public PackageInstaller(WixTestContext testContext, string filename)
12
{
13
- this.Package = Path.Combine(testContext.TestDataFolder, $"{name}.msi");
14
- this.PackagePdb = Path.Combine(testContext.TestDataFolder, $"{name}.wixpdb");
15
- this.PackageName = name;
13
+ this.Package = Path.Combine(testContext.TestDataFolder, $"{filename}.msi");
14
+ this.PackagePdb = Path.Combine(testContext.TestDataFolder, $"{filename}.wixpdb");
15
this.TestContext = testContext;
16
}
17
src/WixToolsetTest.BurnE2E/PackageVerifier.cs
+30
-3
@@ -12,15 +12,13 @@ namespace WixToolsetTest.BurnE2E
12
13
public partial class PackageInstaller
14
{
15
- private string PackageName { get; }
16
-
15
public string PackagePdb { get; }
16
17
private WindowsInstallerData WiData { get; set; }
18
19
public string GetInstalledFilePath(string filename)
20
{
23
- return this.TestContext.GetTestInstallFolder(Path.Combine(this.PackageName, filename));
21
+ return this.TestContext.GetTestInstallFolder(Path.Combine(this.GetInstallFolderName(), filename));
22
}
23
24
private WindowsInstallerData GetWindowsInstallerData()
@@ -34,6 +32,19 @@ namespace WixToolsetTest.BurnE2E
32
return this.WiData;
33
}
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
+
48
public string GetProperty(string name)
49
{
50
var wiData = this.GetWindowsInstallerData();
@@ -46,5 +57,21 @@ namespace WixToolsetTest.BurnE2E
57
var productCode = this.GetProperty("ProductCode");
58
Assert.Equal(installed, MsiUtilities.IsProductInstalled(productCode));
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
+ }
76
}
77
}
src/WixToolsetTest.BurnE2E/PatchTests.cs
new
+137
@@ -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
+}
src/WixToolsetTest.BurnE2E/WixTestContext.cs
+1
-1
@@ -57,7 +57,7 @@ namespace WixToolsetTest.BurnE2E
57
/// </remarks>
58
public RegistryKey GetTestRegistryRoot(string additionalPath = null)
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);
62
}
63
src/WixToolsetTest.BurnE2E/WixToolsetTest.BurnE2E.csproj
+1
-1
@@ -16,7 +16,7 @@
16
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" />
17
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
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" />
21
</ItemGroup>
22