diff options
| author | Bob Arnson <bob@firegiant.com> | 2026-02-17 19:41:03 -0500 |
|---|---|---|
| committer | Bob Arnson <bob@firegiant.com> | 2026-02-17 19:48:12 -0500 |
| commit | 5658492062bf28ffb670ede15cbd1413bf1182d8 (patch) | |
| tree | 7e959881fdabed13359ff8cb78e68d9c74b81931 /src/test | |
| parent | de80ff1102a1b34e430bbc718fe65a42bab196cf (diff) | |
| download | wix-bob/BundleLockUpgradeScope.tar.gz wix-bob/BundleLockUpgradeScope.tar.bz2 wix-bob/BundleLockUpgradeScope.zip | |
Lock upgrade bundles to original bundle's scope.bob/BundleLockUpgradeScope
Fixes https://github.com/wixtoolset/issues/issues/9236
Diffstat (limited to '')
5 files changed, 59 insertions, 1 deletions
diff --git a/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/AllPuomBundleTestBA.wixproj b/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/AllPuomBundleTestBA.wixproj index 30d850d4..258d7b42 100644 --- a/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/AllPuomBundleTestBA.wixproj +++ b/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/AllPuomBundleTestBA.wixproj | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | <Project Sdk="WixToolset.Sdk"> | 1 | <Project Sdk="WixToolset.Sdk"> |
| 2 | <PropertyGroup> | 2 | <PropertyGroup> |
| 3 | <BA>TestBA</BA> | 3 | <BA>TestBA</BA> |
| 4 | <DefineConstants>$(DefineConstants);Version=1.0.0.0</DefineConstants> | ||
| 4 | </PropertyGroup> | 5 | </PropertyGroup> |
| 5 | 6 | ||
| 6 | <Import Project="Bundle.props" /> | 7 | <Import Project="Bundle.props" /> |
diff --git a/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/AllPuomBundleTestBAv2.wixproj b/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/AllPuomBundleTestBAv2.wixproj new file mode 100644 index 00000000..0daacca8 --- /dev/null +++ b/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/AllPuomBundleTestBAv2.wixproj | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | <Project Sdk="WixToolset.Sdk"> | ||
| 2 | <PropertyGroup> | ||
| 3 | <BA>TestBA</BA> | ||
| 4 | <DefineConstants>$(DefineConstants);Version=2.0.0.0</DefineConstants> | ||
| 5 | </PropertyGroup> | ||
| 6 | |||
| 7 | <Import Project="Bundle.props" /> | ||
| 8 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/AllPuomBundleWixStdBA.wixproj b/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/AllPuomBundleWixStdBA.wixproj index 56db1fdc..9ca5f8a3 100644 --- a/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/AllPuomBundleWixStdBA.wixproj +++ b/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/AllPuomBundleWixStdBA.wixproj | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | <Project Sdk="WixToolset.Sdk"> | 1 | <Project Sdk="WixToolset.Sdk"> |
| 2 | <PropertyGroup> | 2 | <PropertyGroup> |
| 3 | <BA>WixStdBA</BA> | 3 | <BA>WixStdBA</BA> |
| 4 | <DefineConstants>$(DefineConstants);Version=1.0.0.0</DefineConstants> | ||
| 4 | </PropertyGroup> | 5 | </PropertyGroup> |
| 5 | 6 | ||
| 6 | <Import Project="Bundle.props" /> | 7 | <Import Project="Bundle.props" /> |
diff --git a/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/Bundle.wxs b/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/Bundle.wxs index 4cb11a98..8e1a881a 100644 --- a/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/Bundle.wxs +++ b/src/test/burn/TestData/ConfigurableScopeTests/AllPuomBundle/Bundle.wxs | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> |
| 2 | <Bundle Id="AllPuomBundle$(BA)" Name="AllPuomBundle$(BA)" Manufacturer="Acme" Version="1.0.0.0"> | 2 | <Bundle Id="AllPuomBundle$(BA)" Name="AllPuomBundle$(BA)" Manufacturer="Acme" Version="$(Version)"> |
| 3 | <?if $(BA) = "WixStdBA"?> | 3 | <?if $(BA) = "WixStdBA"?> |
| 4 | <BootstrapperApplication> | 4 | <BootstrapperApplication> |
| 5 | <bal:WixStandardBootstrapperApplication LicenseUrl="https://www.example.com/license" Theme="hyperlinkLicense" /> | 5 | <bal:WixStandardBootstrapperApplication LicenseUrl="https://www.example.com/license" Theme="hyperlinkLicense" /> |
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/ConfigurableScopeTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/ConfigurableScopeTests.cs index 8b31ac00..bb1381b3 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/ConfigurableScopeTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/ConfigurableScopeTests.cs | |||
| @@ -96,6 +96,54 @@ namespace WixToolsetTest.BurnE2E | |||
| 96 | } | 96 | } |
| 97 | 97 | ||
| 98 | [RuntimeFact] | 98 | [RuntimeFact] |
| 99 | public void BundleUpgradeIsLockedToFirstBundlesScope() | ||
| 100 | { | ||
| 101 | var testBAController = this.CreateTestBAController(); | ||
| 102 | testBAController.SetBundleScope(BundleScope.Default); | ||
| 103 | |||
| 104 | var bundle = this.CreateBundleInstaller("AllPuomBundleTestBA"); | ||
| 105 | var log = bundle.Install(); | ||
| 106 | |||
| 107 | bundle.VerifyRegisteredAndInPackageCache(plannedPerMachine: false); | ||
| 108 | |||
| 109 | Assert.True(LogVerifier.MessageInLogFile(log, "Plan begin, 3 packages, action: Install, planned scope: Default")); | ||
| 110 | |||
| 111 | log = bundle.Repair(); | ||
| 112 | Assert.True(LogVerifier.MessageInLogFile(log, "Bundle was already installed with scope: PerUser. Scope cannot change during maintenance.")); | ||
| 113 | |||
| 114 | var bundleV2 = this.CreateBundleInstaller("AllPuomBundleTestBAv2"); | ||
| 115 | testBAController.SetBundleScope(BundleScope.PerMachine); | ||
| 116 | log = bundleV2.Install(); | ||
| 117 | Assert.True(LogVerifier.MessageInLogFileRegex(log, @"Upgraded bundle [{][0-9A-Fa-f\-]{36}[}] was already installed with scope: PerUser\. Scope cannot change during upgrade\.")); | ||
| 118 | |||
| 119 | bundleV2.Uninstall(); | ||
| 120 | bundleV2.VerifyUnregisteredAndRemovedFromPackageCache(plannedPerMachine: false); | ||
| 121 | bundle.VerifyUnregisteredAndRemovedFromPackageCache(plannedPerMachine: false); | ||
| 122 | } | ||
| 123 | |||
| 124 | [RuntimeFact] | ||
| 125 | public void BundleUpgradeWithSameScopeSucceeds() | ||
| 126 | { | ||
| 127 | var bundle = this.CreateBundleInstaller("AllPuomBundleTestBA"); | ||
| 128 | var log = bundle.Install(); | ||
| 129 | |||
| 130 | bundle.VerifyRegisteredAndInPackageCache(plannedPerMachine: false); | ||
| 131 | |||
| 132 | Assert.True(LogVerifier.MessageInLogFile(log, "Plan begin, 3 packages, action: Install, planned scope: Default")); | ||
| 133 | |||
| 134 | log = bundle.Repair(); | ||
| 135 | Assert.True(LogVerifier.MessageInLogFile(log, "Bundle was already installed with scope: PerUser. Scope cannot change during maintenance.")); | ||
| 136 | |||
| 137 | var bundleV2 = this.CreateBundleInstaller("AllPuomBundleTestBAv2"); | ||
| 138 | log = bundleV2.Install(); | ||
| 139 | Assert.True(LogVerifier.MessageInLogFileRegex(log, @"Upgraded bundle [{][0-9A-Fa-f\-]{36}[}] was already installed with scope: PerUser\. Scope cannot change during upgrade\.")); | ||
| 140 | |||
| 141 | bundleV2.Uninstall(); | ||
| 142 | bundleV2.VerifyUnregisteredAndRemovedFromPackageCache(plannedPerMachine: false); | ||
| 143 | bundle.VerifyUnregisteredAndRemovedFromPackageCache(plannedPerMachine: false); | ||
| 144 | } | ||
| 145 | |||
| 146 | [RuntimeFact] | ||
| 99 | public void PMOU_Bundle_Default_Plan_Installs_PerMachine() | 147 | public void PMOU_Bundle_Default_Plan_Installs_PerMachine() |
| 100 | { | 148 | { |
| 101 | var testBAController = this.CreateTestBAController(); | 149 | var testBAController = this.CreateTestBAController(); |
