@joebigelow / wix / commits / bd0f3491

wixstdba should not change the action if not showing full UI. wixstdba should not block downgrading if run from an upgrade related bundle.

wixstdba should not change the action if not showing full UI. wixstdba should not block downgrading if run from an upgrade related bundle. Fixes 7081

Sean Hall committed Dec 12, 2022 at 23:09 UTC bd0f3491f36f4e24dd899e0c3479beed6e3c00f9
7 files changed +93 -2
src/ext/Bal/wixstdba/WixStandardBootstrapperApplication.cpp
+3 -2
@@ -271,8 +271,9 @@ public: // IBootstrapperApplication
271 }
272 }
273 }
274 - else // maybe modify the action state if the bundle is or is not already installed.
274 + else if (BOOTSTRAPPER_DISPLAY_FULL <= m_command.display) // only modify the action state if showing full UI.
275 {
276 + // Maybe modify the action state if the bundle is or is not already installed.
277 if (fInstalled && BOOTSTRAPPER_RESUME_TYPE_REBOOT != m_command.resumeType && BOOTSTRAPPER_ACTION_INSTALL == m_command.action)
278 {
279 m_command.action = BOOTSTRAPPER_ACTION_MODIFY;
@@ -329,7 +330,7 @@ public: // IBootstrapperApplication
330 // Best effort
331 }
332
332 - if (BOOTSTRAPPER_ACTION_INSTALL == m_command.action && BOOTSTRAPPER_RELATION_UPGRADE == relationType)
333 + if (BOOTSTRAPPER_ACTION_INSTALL == m_command.action && BOOTSTRAPPER_RELATION_UPGRADE != m_command.relationType && BOOTSTRAPPER_RELATION_UPGRADE == relationType)
334 {
335 int nResult = 0;
336 HRESULT hr = VerCompareStringVersions(m_sczBundleVersion, wzVersion, TRUE/*fStrict*/, &nResult);
src/test/burn/TestData/UpgradeRelatedBundleTests/BundleAv2wixstdba/BundleAv2wixstdba.wixproj new
+15
@@ -0,0 +1,15 @@
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="BundleAwixstdba.props" />
4 + <PropertyGroup>
5 + <Version>2.0.0.0</Version>
6 + </PropertyGroup>
7 + <ItemGroup>
8 + <ProjectReference Include="..\PackageAv2\PackageAv2.wixproj" />
9 + <ProjectReference Include="..\..\TestBA\TestBAWixlib\testbawixlib.wixproj" />
10 + </ItemGroup>
11 + <ItemGroup>
12 + <PackageReference Include="WixToolset.Bal.wixext" />
13 + <PackageReference Include="WixToolset.NetFx.wixext" />
14 + </ItemGroup>
15 +</Project>
\ No newline at end of file
src/test/burn/TestData/UpgradeRelatedBundleTests/BundleAv2wixstdba/BundleAv2wixstdba.wxs 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 +
3 +
4 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
5 + <Fragment>
6 + <PackageGroup Id="BundlePackages">
7 + <MsiPackage Id="PackageA" SourceFile="$(var.PackageAv2.TargetPath)" />
8 + </PackageGroup>
9 + </Fragment>
10 +</Wix>
src/test/burn/TestData/UpgradeRelatedBundleTests/BundleAv2wixstdba/BundleAwixstdba.props 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 +<Project>
3 + <PropertyGroup>
4 + <OutputType>Bundle</OutputType>
5 + <BA>hyperlinkLicense</BA>
6 + <UpgradeCode>{5AA6B2C7-F3BC-4A49-812D-90F10C0BA8A1}</UpgradeCode>
7 + </PropertyGroup>
8 + <ItemGroup>
9 + <Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" />
10 + </ItemGroup>
11 +</Project>
src/test/burn/TestData/UpgradeRelatedBundleTests/BundleAv3wixstdba/BundleAv3wixstdba.wixproj new
+16
@@ -0,0 +1,16 @@
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="..\BundleAv2wixstdba\BundleAwixstdba.props" />
4 + <PropertyGroup>
5 + <Version>3.0.0.0</Version>
6 + </PropertyGroup>
7 + <ItemGroup>
8 + <ProjectReference Include="..\PackageAv3\PackageAv3.wixproj" />
9 + <ProjectReference Include="..\PackageF\PackageF.wixproj" />
10 + <ProjectReference Include="..\..\TestBA\TestBAWixlib\testbawixlib.wixproj" />
11 + </ItemGroup>
12 + <ItemGroup>
13 + <PackageReference Include="WixToolset.Bal.wixext" />
14 + <PackageReference Include="WixToolset.NetFx.wixext" />
15 + </ItemGroup>
16 +</Project>
\ No newline at end of file
src/test/burn/TestData/UpgradeRelatedBundleTests/BundleAv3wixstdba/BundleAv3wixstdba.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 +
4 +<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
5 + <Fragment>
6 + <PackageGroup Id="BundlePackages">
7 + <MsiPackage Id="PackageA" SourceFile="$(var.PackageAv3.TargetPath)" />
8 + <MsiPackage Id="PackageF" SourceFile="$(var.PackageF.TargetPath)" />
9 + </PackageGroup>
10 + </Fragment>
11 +</Wix>
src/test/burn/WixToolsetTest.BurnE2E/UpgradeRelatedBundleTests.cs
+27
@@ -39,6 +39,33 @@ namespace WixToolsetTest.BurnE2E
39 packageAv3.VerifyInstalled(false);
40 }
41
42 + [RuntimeFact]
43 + public void ReinstallsOlderBundleAfterFailureWixstdba()
44 + {
45 + var packageAv2 = this.CreatePackageInstaller("PackageAv2");
46 + var packageAv3 = this.CreatePackageInstaller("PackageAv3");
47 + var bundleAv2 = this.CreateBundleInstaller("BundleAv2wixstdba");
48 + var bundleAv3 = this.CreateBundleInstaller("BundleAv3wixstdba");
49 +
50 + packageAv2.VerifyInstalled(false);
51 + packageAv3.VerifyInstalled(false);
52 +
53 + bundleAv2.Install();
54 + bundleAv2.VerifyRegisteredAndInPackageCache();
55 +
56 + packageAv2.VerifyInstalled(true);
57 + packageAv3.VerifyInstalled(false);
58 +
59 + // Verify https://github.com/wixtoolset/issues/issues/3421
60 + var bundleAv3InstallLogFilePath = bundleAv3.Install((int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE);
61 + bundleAv3.VerifyUnregisteredAndRemovedFromPackageCache();
62 +
63 + Assert.True(LogVerifier.MessageInLogFileRegex(bundleAv3InstallLogFilePath, @"Applied execute package: PackageA, result: 0x0, restart: None"));
64 +
65 + packageAv2.VerifyInstalled(true);
66 + packageAv3.VerifyInstalled(false);
67 + }
68 +
69 [RuntimeFact]
70 public void ReportsRelatedBundleMissingFromCache()
71 {