diff options
author | Sean Hall <r.sean.hall@gmail.com> | 2021-12-30 15:32:57 -0600 |
---|---|---|
committer | Sean Hall <r.sean.hall@gmail.com> | 2021-12-30 18:40:49 -0600 |
commit | 8dfadd0c9068965af138949b630ef8496b4f7bbb (patch) | |
tree | 58bc40d5306d80a39712470aab0d5bf325eb3a45 /src/test | |
parent | 84a1b0f8ffe40a26916b1dfb3e1b59b6b0c31ad4 (diff) | |
download | wix-8dfadd0c9068965af138949b630ef8496b4f7bbb.tar.gz wix-8dfadd0c9068965af138949b630ef8496b4f7bbb.tar.bz2 wix-8dfadd0c9068965af138949b630ef8496b4f7bbb.zip |
Don't report related operation in OnDetectRelatedBundle.
#5796
Diffstat (limited to 'src/test')
5 files changed, 76 insertions, 18 deletions
diff --git a/src/test/burn/TestData/WixStdBaTests/BundleA_v10/BundleA_v10.wixproj b/src/test/burn/TestData/WixStdBaTests/BundleA_v10/BundleA_v10.wixproj new file mode 100644 index 00000000..602dc4bc --- /dev/null +++ b/src/test/burn/TestData/WixStdBaTests/BundleA_v10/BundleA_v10.wixproj | |||
@@ -0,0 +1,20 @@ | |||
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>hyperlinkLicense</BA> | ||
6 | <UpgradeCode>{7D977157-06C9-4176-A931-AC16E18AAB51}</UpgradeCode> | ||
7 | <DefineConstants>$(DefineConstants);Version=1.0</DefineConstants> | ||
8 | <OutputName>WixStdBaTest1_v10</OutputName> | ||
9 | </PropertyGroup> | ||
10 | <ItemGroup> | ||
11 | <Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" /> | ||
12 | <Compile Include="..\BundleA\BundleA.wxs" Link="BundleA.wxs" /> | ||
13 | </ItemGroup> | ||
14 | <ItemGroup> | ||
15 | <ProjectReference Include="..\PackageA\PackageA.wixproj" /> | ||
16 | </ItemGroup> | ||
17 | <ItemGroup> | ||
18 | <PackageReference Include="WixToolset.Bal.wixext" /> | ||
19 | </ItemGroup> | ||
20 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/WixToolset.WixBA/InstallationViewModel.cs b/src/test/burn/WixToolset.WixBA/InstallationViewModel.cs index 1846d51b..e056b943 100644 --- a/src/test/burn/WixToolset.WixBA/InstallationViewModel.cs +++ b/src/test/burn/WixToolset.WixBA/InstallationViewModel.cs | |||
@@ -19,6 +19,18 @@ namespace WixToolset.WixBA | |||
19 | { | 19 | { |
20 | Absent, | 20 | Absent, |
21 | Present, | 21 | Present, |
22 | } | ||
23 | |||
24 | /// <summary> | ||
25 | /// The states of upgrade detection. | ||
26 | /// </summary> | ||
27 | public enum UpgradeDetectionState | ||
28 | { | ||
29 | // There are no Upgrade related bundles installed. | ||
30 | None, | ||
31 | // All Upgrade related bundles that are installed are older than or the same version as this bundle. | ||
32 | Older, | ||
33 | // At least one Upgrade related bundle is installed that is newer than this bundle. | ||
22 | Newer, | 34 | Newer, |
23 | } | 35 | } |
24 | 36 | ||
@@ -90,7 +102,7 @@ namespace WixToolset.WixBA | |||
90 | 102 | ||
91 | void RootPropertyChanged(object sender, PropertyChangedEventArgs e) | 103 | void RootPropertyChanged(object sender, PropertyChangedEventArgs e) |
92 | { | 104 | { |
93 | if (("DetectState" == e.PropertyName) || ("InstallState" == e.PropertyName)) | 105 | if (("DetectState" == e.PropertyName) || ("UpgradeDetectState" == e.PropertyName) || ("InstallState" == e.PropertyName)) |
94 | { | 106 | { |
95 | base.OnPropertyChanged("RepairEnabled"); | 107 | base.OnPropertyChanged("RepairEnabled"); |
96 | base.OnPropertyChanged("InstallEnabled"); | 108 | base.OnPropertyChanged("InstallEnabled"); |
@@ -276,7 +288,9 @@ namespace WixToolset.WixBA | |||
276 | { | 288 | { |
277 | if (this.installCommand == null) | 289 | if (this.installCommand == null) |
278 | { | 290 | { |
279 | this.installCommand = new RelayCommand(param => WixBA.Plan(LaunchAction.Install), param => this.root.DetectState == DetectionState.Absent && this.root.InstallState == InstallationState.Waiting); | 291 | this.installCommand = new RelayCommand( |
292 | param => WixBA.Plan(LaunchAction.Install), | ||
293 | param => this.root.DetectState == DetectionState.Absent && this.root.UpgradeDetectState != UpgradeDetectionState.Newer && this.root.InstallState == InstallationState.Waiting); | ||
280 | } | 294 | } |
281 | 295 | ||
282 | return this.installCommand; | 296 | return this.installCommand; |
@@ -399,9 +413,19 @@ namespace WixToolset.WixBA | |||
399 | 413 | ||
400 | private void DetectedRelatedBundle(object sender, DetectRelatedBundleEventArgs e) | 414 | private void DetectedRelatedBundle(object sender, DetectRelatedBundleEventArgs e) |
401 | { | 415 | { |
402 | if (e.Operation == RelatedOperation.Downgrade) | 416 | if (e.RelationType == RelationType.Upgrade) |
403 | { | 417 | { |
404 | this.Downgrade = true; | 418 | if (WixBA.Model.Engine.CompareVersions(this.Version, e.Version) > 0) |
419 | { | ||
420 | if (this.root.UpgradeDetectState == UpgradeDetectionState.None) | ||
421 | { | ||
422 | this.root.UpgradeDetectState = UpgradeDetectionState.Older; | ||
423 | } | ||
424 | } | ||
425 | else | ||
426 | { | ||
427 | this.root.UpgradeDetectState = UpgradeDetectionState.Newer; | ||
428 | } | ||
405 | } | 429 | } |
406 | 430 | ||
407 | if (!WixBA.Model.BAManifest.Bundle.Packages.ContainsKey(e.ProductCode)) | 431 | if (!WixBA.Model.BAManifest.Bundle.Packages.ContainsKey(e.ProductCode)) |
@@ -432,19 +456,10 @@ namespace WixToolset.WixBA | |||
432 | } | 456 | } |
433 | else if (Hresult.Succeeded(e.Status)) | 457 | else if (Hresult.Succeeded(e.Status)) |
434 | { | 458 | { |
435 | if (this.Downgrade) | 459 | if (this.root.UpgradeDetectState == UpgradeDetectionState.Newer) |
436 | { | 460 | { |
437 | this.root.DetectState = DetectionState.Newer; | 461 | this.Downgrade = true; |
438 | var relatedPackages = WixBA.Model.BAManifest.Bundle.Packages.Values.Where(p => p.Type == PackageType.UpgradeBundle); | 462 | this.DowngradeMessage = "There is already a newer version of WiX installed on this machine."; |
439 | var installedVersion = relatedPackages.Any() ? new Version(relatedPackages.Max(p => p.Version)) : null; | ||
440 | if (installedVersion != null && installedVersion < new Version(4, 1) && installedVersion.Build > 10) | ||
441 | { | ||
442 | this.DowngradeMessage = "You must uninstall WiX v" + installedVersion + " before you can install this."; | ||
443 | } | ||
444 | else | ||
445 | { | ||
446 | this.DowngradeMessage = "There is already a newer version of WiX installed on this machine."; | ||
447 | } | ||
448 | } | 463 | } |
449 | 464 | ||
450 | if (LaunchAction.Layout == WixBA.Model.Command.Action) | 465 | if (LaunchAction.Layout == WixBA.Model.Command.Action) |
diff --git a/src/test/burn/WixToolset.WixBA/RootViewModel.cs b/src/test/burn/WixToolset.WixBA/RootViewModel.cs index 8cff7274..2dfd214e 100644 --- a/src/test/burn/WixToolset.WixBA/RootViewModel.cs +++ b/src/test/burn/WixToolset.WixBA/RootViewModel.cs | |||
@@ -27,6 +27,7 @@ namespace WixToolset.WixBA | |||
27 | private bool canceled; | 27 | private bool canceled; |
28 | private InstallationState installState; | 28 | private InstallationState installState; |
29 | private DetectionState detectState; | 29 | private DetectionState detectState; |
30 | private UpgradeDetectionState upgradeDetectState; | ||
30 | 31 | ||
31 | /// <summary> | 32 | /// <summary> |
32 | /// Creates a new model of the root view. | 33 | /// Creates a new model of the root view. |
@@ -120,6 +121,28 @@ namespace WixToolset.WixBA | |||
120 | } | 121 | } |
121 | 122 | ||
122 | /// <summary> | 123 | /// <summary> |
124 | /// Gets and sets the upgrade detect state of the view's model. | ||
125 | /// </summary> | ||
126 | public UpgradeDetectionState UpgradeDetectState | ||
127 | { | ||
128 | get | ||
129 | { | ||
130 | return this.upgradeDetectState; | ||
131 | } | ||
132 | |||
133 | set | ||
134 | { | ||
135 | if (this.upgradeDetectState != value) | ||
136 | { | ||
137 | this.upgradeDetectState = value; | ||
138 | |||
139 | // Notify all the properties derived from the state that the state changed. | ||
140 | base.OnPropertyChanged("UpgradeDetectState"); | ||
141 | } | ||
142 | } | ||
143 | } | ||
144 | |||
145 | /// <summary> | ||
123 | /// Gets and sets the installation state of the view's model. | 146 | /// Gets and sets the installation state of the view's model. |
124 | /// </summary> | 147 | /// </summary> |
125 | public InstallationState InstallState | 148 | public InstallationState InstallState |
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/DependencyTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/DependencyTests.cs index e2975fc9..309241d9 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/DependencyTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/DependencyTests.cs | |||
@@ -596,7 +596,7 @@ namespace WixToolsetTest.BurnE2E | |||
596 | packageDv2.VerifyInstalled(true); | 596 | packageDv2.VerifyInstalled(true); |
597 | 597 | ||
598 | Assert.True(LogVerifier.MessageInLogFileRegex(bundleHv2InstallLogFilePath, @"Skipping cross-scope dependency registration on package: PackageA, bundle scope: PerUser, package scope: PerMachine")); | 598 | Assert.True(LogVerifier.MessageInLogFileRegex(bundleHv2InstallLogFilePath, @"Skipping cross-scope dependency registration on package: PackageA, bundle scope: PerUser, package scope: PerMachine")); |
599 | Assert.True(LogVerifier.MessageInLogFileRegex(bundleHv2InstallLogFilePath, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Upgrade, scope: PerUser, version: 1\.0\.0\.0, operation: MajorUpgrade, cached: Yes")); | 599 | Assert.True(LogVerifier.MessageInLogFileRegex(bundleHv2InstallLogFilePath, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Upgrade, scope: PerUser, version: 1\.0\.0\.0, cached: Yes")); |
600 | 600 | ||
601 | bundleHv2.Uninstall(); | 601 | bundleHv2.Uninstall(); |
602 | bundleHv2.VerifyUnregisteredAndRemovedFromPackageCache(); | 602 | bundleHv2.VerifyUnregisteredAndRemovedFromPackageCache(); |
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/UpgradeRelatedBundleTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/UpgradeRelatedBundleTests.cs index 70c0c474..35cc64f0 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/UpgradeRelatedBundleTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/UpgradeRelatedBundleTests.cs | |||
@@ -30,7 +30,7 @@ namespace WixToolsetTest.BurnE2E | |||
30 | bundleAv2.VerifyRegisteredAndInPackageCache(); | 30 | bundleAv2.VerifyRegisteredAndInPackageCache(); |
31 | 31 | ||
32 | Assert.True(LogVerifier.MessageInLogFileRegex(bundleAv2InstallLogFilePath, @"OnDetectRelatedBundle\(\) - id: \{[0-9A-Za-z\-]{36}\}, missing from cache: True")); | 32 | Assert.True(LogVerifier.MessageInLogFileRegex(bundleAv2InstallLogFilePath, @"OnDetectRelatedBundle\(\) - id: \{[0-9A-Za-z\-]{36}\}, missing from cache: True")); |
33 | Assert.True(LogVerifier.MessageInLogFileRegex(bundleAv2InstallLogFilePath, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Upgrade, scope: PerMachine, version: 1\.0\.0\.0, operation: MajorUpgrade, cached: No")); | 33 | Assert.True(LogVerifier.MessageInLogFileRegex(bundleAv2InstallLogFilePath, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Upgrade, scope: PerMachine, version: 1\.0\.0\.0, cached: No")); |
34 | } | 34 | } |
35 | } | 35 | } |
36 | } | 36 | } |