diff options
author | Bob Arnson <bob@firegiant.com> | 2025-03-20 21:14:12 -0400 |
---|---|---|
committer | Bob Arnson <bob@firegiant.com> | 2025-03-24 18:18:52 -0400 |
commit | f3fb208959d5ef2f8df19f518224d413b233f751 (patch) | |
tree | 0ef9b5f2e59edb2f25ad0040a1bfa293155c309c /src/test/burn/WixTestTools/BundleVerifier.cs | |
parent | bf13a0b67dd644eb7d74cb0cfb6876840f73d82b (diff) | |
download | wix-bob/UpdateRegistrationAcrossUpgrades.tar.gz wix-bob/UpdateRegistrationAcrossUpgrades.tar.bz2 wix-bob/UpdateRegistrationAcrossUpgrades.zip |
Update registration disappears during upgrade.bob/UpdateRegistrationAcrossUpgrades
Update registration is stored in a shared registry key that Burn takes
care to keep around across upgrades. The approach it used broke
between WiX v3 and WiX v5. This change makes it work again by
writing update registration when the session ends.
Diffstat (limited to 'src/test/burn/WixTestTools/BundleVerifier.cs')
-rw-r--r-- | src/test/burn/WixTestTools/BundleVerifier.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/test/burn/WixTestTools/BundleVerifier.cs b/src/test/burn/WixTestTools/BundleVerifier.cs index da61d96e..b6181047 100644 --- a/src/test/burn/WixTestTools/BundleVerifier.cs +++ b/src/test/burn/WixTestTools/BundleVerifier.cs | |||
@@ -6,6 +6,7 @@ namespace WixTestTools | |||
6 | using System.IO; | 6 | using System.IO; |
7 | using System.Linq; | 7 | using System.Linq; |
8 | using System.Text; | 8 | using System.Text; |
9 | using System.Xml.Linq; | ||
9 | using Microsoft.Win32; | 10 | using Microsoft.Win32; |
10 | using WixInternal.TestSupport; | 11 | using WixInternal.TestSupport; |
11 | using WixToolset.Data; | 12 | using WixToolset.Data; |
@@ -23,6 +24,8 @@ namespace WixTestTools | |||
23 | 24 | ||
24 | private WixBundleSymbol BundleSymbol { get; set; } | 25 | private WixBundleSymbol BundleSymbol { get; set; } |
25 | 26 | ||
27 | private WixUpdateRegistrationSymbol UpdateRegistrationSymbol { get; set; } | ||
28 | |||
26 | private WixBundleSymbol GetBundleSymbol() | 29 | private WixBundleSymbol GetBundleSymbol() |
27 | { | 30 | { |
28 | if (this.BundleSymbol == null) | 31 | if (this.BundleSymbol == null) |
@@ -36,6 +39,19 @@ namespace WixTestTools | |||
36 | return this.BundleSymbol; | 39 | return this.BundleSymbol; |
37 | } | 40 | } |
38 | 41 | ||
42 | private WixUpdateRegistrationSymbol GetUpdateRegistrationSymbol() | ||
43 | { | ||
44 | if (this.UpdateRegistrationSymbol == null) | ||
45 | { | ||
46 | using var wixOutput = WixOutput.Read(this.BundlePdb); | ||
47 | var intermediate = Intermediate.Load(wixOutput); | ||
48 | var section = intermediate.Sections.Single(); | ||
49 | this.UpdateRegistrationSymbol = section.Symbols.OfType<WixUpdateRegistrationSymbol>().Single(); | ||
50 | } | ||
51 | |||
52 | return this.UpdateRegistrationSymbol; | ||
53 | } | ||
54 | |||
39 | public string GetFullBurnPolicyRegistryPath() | 55 | public string GetFullBurnPolicyRegistryPath() |
40 | { | 56 | { |
41 | var bundleSymbol = this.GetBundleSymbol(); | 57 | var bundleSymbol = this.GetBundleSymbol(); |
@@ -118,6 +134,27 @@ namespace WixTestTools | |||
118 | } | 134 | } |
119 | } | 135 | } |
120 | 136 | ||
137 | public bool TryGetUpdateRegistration(out BundleUpdateRegistration registration) | ||
138 | { | ||
139 | var bundleSymbol = this.GetBundleSymbol(); | ||
140 | var x64 = bundleSymbol.Platform != Platform.X86; | ||
141 | |||
142 | var updateRegistrationSymbol = this.GetUpdateRegistrationSymbol(); | ||
143 | var manufacturer = updateRegistrationSymbol.Manufacturer; | ||
144 | var productFamily = updateRegistrationSymbol.ProductFamily; | ||
145 | var name = updateRegistrationSymbol.Name; | ||
146 | |||
147 | |||
148 | if (bundleSymbol.PerMachine) | ||
149 | { | ||
150 | return BundleUpdateRegistration.TryGetPerMachineBundleUpdateRegistration(manufacturer, productFamily, name, x64, out registration); | ||
151 | } | ||
152 | else | ||
153 | { | ||
154 | return BundleUpdateRegistration.TryGetPerUserBundleUpdateRegistration(manufacturer, productFamily, name, out registration); | ||
155 | } | ||
156 | } | ||
157 | |||
121 | public BundleRegistration VerifyRegisteredAndInPackageCache(int? expectedSystemComponent = null) | 158 | public BundleRegistration VerifyRegisteredAndInPackageCache(int? expectedSystemComponent = null) |
122 | { | 159 | { |
123 | Assert.True(this.TryGetRegistration(out var registration)); | 160 | Assert.True(this.TryGetRegistration(out var registration)); |