diff options
| author | Bob Arnson <bob@firegiant.com> | 2026-04-01 16:06:45 -0400 |
|---|---|---|
| committer | Bob Arnson <github@bobs.org> | 2026-04-01 17:39:59 -0400 |
| commit | cb06f75799d845eeb78d326d4b1295921acd0bad (patch) | |
| tree | 65891cf4579cc0f530c4615c87439d0e9dc502f9 | |
| parent | b4da272e25c5c776cc5c66ee069bd3fb7548dd92 (diff) | |
| download | wix-cb06f75799d845eeb78d326d4b1295921acd0bad.tar.gz wix-cb06f75799d845eeb78d326d4b1295921acd0bad.tar.bz2 wix-cb06f75799d845eeb78d326d4b1295921acd0bad.zip | |
Handle lack of scope for pre-v7 bundles.
Fixes https://github.com/wixtoolset/issues/issues/9274
14 files changed, 128 insertions, 5 deletions
diff --git a/src/Directory.csproj.props b/src/Directory.csproj.props index 42407929..6891ef2f 100644 --- a/src/Directory.csproj.props +++ b/src/Directory.csproj.props | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | <Project> | 3 | <Project> |
| 4 | <PropertyGroup> | 4 | <PropertyGroup> |
| 5 | <LangVersion Condition=" '$(TargetFrameworkVersion)'=='' ">14.0</LangVersion> | 5 | <LangVersion Condition=" '$(TargetFrameworkVersion)'=='' ">13.0</LangVersion> |
| 6 | <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> | 6 | <CheckForOverflowUnderflow>true</CheckForOverflowUnderflow> |
| 7 | <SignAssembly>true</SignAssembly> | 7 | <SignAssembly>true</SignAssembly> |
| 8 | <AssemblyOriginatorKeyFile>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk))</AssemblyOriginatorKeyFile> | 8 | <AssemblyOriginatorKeyFile>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk))</AssemblyOriginatorKeyFile> |
diff --git a/src/burn/engine/relatedbundle.cpp b/src/burn/engine/relatedbundle.cpp index 166c4ae8..2d95111f 100644 --- a/src/burn/engine/relatedbundle.cpp +++ b/src/burn/engine/relatedbundle.cpp | |||
| @@ -356,10 +356,19 @@ static HRESULT LoadRelatedBundleFromKey( | |||
| 356 | LogId(REPORT_WARNING, MSG_RELATED_PACKAGE_INVALID_VERSION, wzRelatedBundleCode, sczBundleVersion); | 356 | LogId(REPORT_WARNING, MSG_RELATED_PACKAGE_INVALID_VERSION, wzRelatedBundleCode, sczBundleVersion); |
| 357 | } | 357 | } |
| 358 | 358 | ||
| 359 | // Look for v7+ scope registration. | ||
| 359 | hr = RegReadNumber(hkBundleCode, BURN_REGISTRATION_REGISTRY_BUNDLE_SCOPE, &dwScope); | 360 | hr = RegReadNumber(hkBundleCode, BURN_REGISTRATION_REGISTRY_BUNDLE_SCOPE, &dwScope); |
| 360 | ExitOnFailure(hr, "Failed to read registration %ls for bundle %ls.", wzRelatedBundleCode, BURN_REGISTRATION_REGISTRY_BUNDLE_SCOPE); | 361 | if (SUCCEEDED(hr)) |
| 362 | { | ||
| 363 | pRelatedBundle->detectedScope = static_cast<BOOTSTRAPPER_SCOPE>(dwScope); | ||
| 364 | } | ||
| 365 | else if (E_FILENOTFOUND == hr) | ||
| 366 | { | ||
| 367 | hr = S_OK; | ||
| 361 | 368 | ||
| 362 | pRelatedBundle->detectedScope = static_cast<BOOTSTRAPPER_SCOPE>(dwScope); | 369 | pRelatedBundle->detectedScope = fPerMachine ? BOOTSTRAPPER_SCOPE_PER_MACHINE : BOOTSTRAPPER_SCOPE_PER_USER; |
| 370 | } | ||
| 371 | ExitOnFailure(hr, "Failed to read registration %ls for bundle %ls.", wzRelatedBundleCode, BURN_REGISTRATION_REGISTRY_BUNDLE_SCOPE); | ||
| 363 | 372 | ||
| 364 | hr = RegReadString(hkBundleCode, BURN_REGISTRATION_REGISTRY_BUNDLE_CACHE_PATH, &sczCachePath); | 373 | hr = RegReadString(hkBundleCode, BURN_REGISTRATION_REGISTRY_BUNDLE_CACHE_PATH, &sczCachePath); |
| 365 | ExitOnFailure(hr, "Failed to read cache path from registry for bundle: %ls", wzRelatedBundleCode); | 374 | ExitOnFailure(hr, "Failed to read cache path from registry for bundle: %ls", wzRelatedBundleCode); |
diff --git a/src/internal/SetBuildNumber/global.json.pp b/src/internal/SetBuildNumber/global.json.pp index b99149d2..b1acc713 100644 --- a/src/internal/SetBuildNumber/global.json.pp +++ b/src/internal/SetBuildNumber/global.json.pp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | "WixToolset.Sdk": "{packageversion}" | 6 | "WixToolset.Sdk": "{packageversion}" |
| 7 | }, | 7 | }, |
| 8 | "sdk": { | 8 | "sdk": { |
| 9 | "version": "10.0.100", | 9 | "version": "9.0.300", |
| 10 | "rollForward": "latestFeature" | 10 | "rollForward": "latestFeature" |
| 11 | } | 11 | } |
| 12 | } | 12 | } |
diff --git a/src/test/burn/TestData/ConfigurableScopeTests/PerMachineBundle/Bundle.wxs b/src/test/burn/TestData/ConfigurableScopeTests/PerMachineBundle/Bundle.wxs index e170667b..eb2a74ac 100644 --- a/src/test/burn/TestData/ConfigurableScopeTests/PerMachineBundle/Bundle.wxs +++ b/src/test/burn/TestData/ConfigurableScopeTests/PerMachineBundle/Bundle.wxs | |||
| @@ -1,9 +1,11 @@ | |||
| 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="PerMachineBundle" Name="PerMachineBundle" Manufacturer="Acme" Version="1.0.0.0"> | 2 | <Bundle Id="PerMachineBundle" Name="PerMachineBundle" Manufacturer="Acme" Version="$(Version)"> |
| 3 | <BootstrapperApplication> | 3 | <BootstrapperApplication> |
| 4 | <bal:WixStandardBootstrapperApplication LicenseUrl="https://www.example.com/license" Theme="hyperlinkLicense" /> | 4 | <bal:WixStandardBootstrapperApplication LicenseUrl="https://www.example.com/license" Theme="hyperlinkLicense" /> |
| 5 | </BootstrapperApplication> | 5 | </BootstrapperApplication> |
| 6 | 6 | ||
| 7 | <Variable Name="TestBundleId" Value="PerMachineBundle v$(Version)" /> | ||
| 8 | |||
| 7 | <Chain> | 9 | <Chain> |
| 8 | <MsiPackage SourceFile="PerMachinePkg.msi" /> | 10 | <MsiPackage SourceFile="PerMachinePkg.msi" /> |
| 9 | </Chain> | 11 | </Chain> |
diff --git a/src/test/burn/TestData/ConfigurableScopeTests/PerMachineBundle/PerMachineBundle.wixproj b/src/test/burn/TestData/ConfigurableScopeTests/PerMachineBundle/PerMachineBundle.wixproj index ade65220..ed15dedf 100644 --- a/src/test/burn/TestData/ConfigurableScopeTests/PerMachineBundle/PerMachineBundle.wixproj +++ b/src/test/burn/TestData/ConfigurableScopeTests/PerMachineBundle/PerMachineBundle.wixproj | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | <Project Sdk="WixToolset.Sdk"> | 1 | <Project Sdk="WixToolset.Sdk"> |
| 2 | <PropertyGroup> | 2 | <PropertyGroup> |
| 3 | <OutputType>Bundle</OutputType> | 3 | <OutputType>Bundle</OutputType> |
| 4 | <DefineConstants>$(DefineConstants);Version=1.0.0.0</DefineConstants> | ||
| 4 | </PropertyGroup> | 5 | </PropertyGroup> |
| 5 | <ItemGroup> | 6 | <ItemGroup> |
| 6 | <PackageReference Include="WixToolset.BootstrapperApplications.wixext" /> | 7 | <PackageReference Include="WixToolset.BootstrapperApplications.wixext" /> |
diff --git a/src/test/burn/TestData/ConfigurableScopeTests/PerMachineBundle/PerMachineBundleV2.wixproj b/src/test/burn/TestData/ConfigurableScopeTests/PerMachineBundle/PerMachineBundleV2.wixproj new file mode 100644 index 00000000..fcdbae05 --- /dev/null +++ b/src/test/burn/TestData/ConfigurableScopeTests/PerMachineBundle/PerMachineBundleV2.wixproj | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | <Project Sdk="WixToolset.Sdk"> | ||
| 2 | <PropertyGroup> | ||
| 3 | <OutputType>Bundle</OutputType> | ||
| 4 | <DefineConstants>$(DefineConstants);Version=2.0.0.0</DefineConstants> | ||
| 5 | </PropertyGroup> | ||
| 6 | <ItemGroup> | ||
| 7 | <PackageReference Include="WixToolset.BootstrapperApplications.wixext" /> | ||
| 8 | </ItemGroup> | ||
| 9 | <ItemGroup> | ||
| 10 | <ProjectReference Include="..\PerMachinePkg\PerMachinePkg.wixproj" /> | ||
| 11 | </ItemGroup> | ||
| 12 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData6/ConfigurableScopeTests/PerMachineBundleWix6/Bundle.wxs b/src/test/burn/TestData6/ConfigurableScopeTests/PerMachineBundleWix6/Bundle.wxs new file mode 100644 index 00000000..22879ee1 --- /dev/null +++ b/src/test/burn/TestData6/ConfigurableScopeTests/PerMachineBundleWix6/Bundle.wxs | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal"> | ||
| 2 | <Bundle Id="PerMachineBundle" Name="PerMachineBundle" Manufacturer="Acme" Version="1.0.0.0"> | ||
| 3 | <BootstrapperApplication> | ||
| 4 | <bal:WixStandardBootstrapperApplication LicenseUrl="https://www.example.com/license" Theme="hyperlinkLicense" /> | ||
| 5 | </BootstrapperApplication> | ||
| 6 | |||
| 7 | <Variable Name="TestBundleId" Value="PerMachineBundleWix6 v1.0.0.0" /> | ||
| 8 | |||
| 9 | <Chain> | ||
| 10 | <MsiPackage SourceFile="PerMachinePkgWix6.msi" /> | ||
| 11 | </Chain> | ||
| 12 | </Bundle> | ||
| 13 | </Wix> | ||
diff --git a/src/test/burn/TestData6/ConfigurableScopeTests/PerMachineBundleWix6/PerMachineBundleWix6.wixproj b/src/test/burn/TestData6/ConfigurableScopeTests/PerMachineBundleWix6/PerMachineBundleWix6.wixproj new file mode 100644 index 00000000..bec8209e --- /dev/null +++ b/src/test/burn/TestData6/ConfigurableScopeTests/PerMachineBundleWix6/PerMachineBundleWix6.wixproj | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | <Project Sdk="WixToolset.Sdk/6.0.2"> | ||
| 2 | <PropertyGroup> | ||
| 3 | <ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally> | ||
| 4 | <OutputType>Bundle</OutputType> | ||
| 5 | </PropertyGroup> | ||
| 6 | <ItemGroup> | ||
| 7 | <PackageReference Include="WixToolset.BootstrapperApplications.wixext" Version="6.0.2" /> | ||
| 8 | </ItemGroup> | ||
| 9 | <ItemGroup> | ||
| 10 | <ProjectReference Include="..\PerMachinePkgWix6\PerMachinePkgWix6.wixproj" /> | ||
| 11 | </ItemGroup> | ||
| 12 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData6/ConfigurableScopeTests/PerMachinePkgWix6/PerMachinePkgWix6.wixproj b/src/test/burn/TestData6/ConfigurableScopeTests/PerMachinePkgWix6/PerMachinePkgWix6.wixproj new file mode 100644 index 00000000..9fa921ec --- /dev/null +++ b/src/test/burn/TestData6/ConfigurableScopeTests/PerMachinePkgWix6/PerMachinePkgWix6.wixproj | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | <Project Sdk="WixToolset.Sdk/6.0.2"> | ||
| 2 | <PropertyGroup> | ||
| 3 | <ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally> | ||
| 4 | </PropertyGroup> | ||
| 5 | </Project> \ No newline at end of file | ||
diff --git a/src/test/burn/TestData6/ConfigurableScopeTests/PerMachinePkgWix6/product.wxs b/src/test/burn/TestData6/ConfigurableScopeTests/PerMachinePkgWix6/product.wxs new file mode 100644 index 00000000..4b14c9d2 --- /dev/null +++ b/src/test/burn/TestData6/ConfigurableScopeTests/PerMachinePkgWix6/product.wxs | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | <Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"> | ||
| 2 | <Package Id="PerMachinePkg" Name="PerMachinePkg" Language="1033" Version="1.0.0.0" Manufacturer="Acme" Scope="perMachine"> | ||
| 3 | <MediaTemplate EmbedCab="yes" /> | ||
| 4 | <File Source="$(sys.SOURCEFILEPATH)" /> | ||
| 5 | </Package> | ||
| 6 | </Wix> | ||
diff --git a/src/test/burn/TestData6/TestData6.proj b/src/test/burn/TestData6/TestData6.proj new file mode 100644 index 00000000..6eeb18fd --- /dev/null +++ b/src/test/burn/TestData6/TestData6.proj | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <!-- 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. --> | ||
| 3 | |||
| 4 | <Project Sdk="Microsoft.Build.Traversal"> | ||
| 5 | <ItemGroup> | ||
| 6 | <ProjectReference Include="**\*.wixproj" /> | ||
| 7 | </ItemGroup> | ||
| 8 | </Project> | ||
diff --git a/src/test/burn/TestData6/nuget.config b/src/test/burn/TestData6/nuget.config new file mode 100644 index 00000000..ec40f2b2 --- /dev/null +++ b/src/test/burn/TestData6/nuget.config | |||
| @@ -0,0 +1,14 @@ | |||
| 1 | <?xml version="1.0" encoding="utf-8"?> | ||
| 2 | <configuration> | ||
| 3 | <packageSources> | ||
| 4 | <clear /> | ||
| 5 | <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /> | ||
| 6 | </packageSources> | ||
| 7 | |||
| 8 | <packageSourceMapping> | ||
| 9 | <packageSource key="nuget.org"> | ||
| 10 | <package pattern="WixToolset.*" /> | ||
| 11 | <package pattern="*" /> | ||
| 12 | </packageSource> | ||
| 13 | </packageSourceMapping> | ||
| 14 | </configuration> | ||
diff --git a/src/test/burn/WixToolsetTest.BurnE2E/ConfigurableScopeTests.cs b/src/test/burn/WixToolsetTest.BurnE2E/ConfigurableScopeTests.cs index 9e8870fc..8dc9c820 100644 --- a/src/test/burn/WixToolsetTest.BurnE2E/ConfigurableScopeTests.cs +++ b/src/test/burn/WixToolsetTest.BurnE2E/ConfigurableScopeTests.cs | |||
| @@ -151,6 +151,46 @@ namespace WixToolsetTest.BurnE2E | |||
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | [RuntimeFact] | 153 | [RuntimeFact] |
| 154 | public void BundleUpgradeFromWix6IsLockedToFirstBundlesScope() | ||
| 155 | { | ||
| 156 | var bundle = this.CreateBundleInstaller("PerMachineBundleWix6"); | ||
| 157 | bundle.Install(); | ||
| 158 | |||
| 159 | bundle.VerifyRegisteredAndInPackageCache(plannedPerMachine: true); | ||
| 160 | |||
| 161 | var testBAController = this.CreateTestBAController(); | ||
| 162 | testBAController.SetBundleScope(BundleScope.PerUser); | ||
| 163 | |||
| 164 | var bundleV2 = this.CreateBundleInstaller("PerMachineBundleV2"); | ||
| 165 | var log = bundleV2.Install(); | ||
| 166 | Assert.True(LogVerifier.MessageInLogFileRegex(log, @"Upgraded bundle [{][0-9A-Fa-f\-]{36}[}] was already installed with scope: PerMachine\. Scope cannot change during upgrade\.")); | ||
| 167 | |||
| 168 | bundleV2.Uninstall(); | ||
| 169 | bundleV2.VerifyUnregisteredAndRemovedFromPackageCache(plannedPerMachine: true); | ||
| 170 | bundle.VerifyUnregisteredAndRemovedFromPackageCache(plannedPerMachine: true); | ||
| 171 | } | ||
| 172 | |||
| 173 | [RuntimeFact] | ||
| 174 | public void BundleUpgradeFromWix6WithSameScopeSucceeds() | ||
| 175 | { | ||
| 176 | var bundle = this.CreateBundleInstaller("PerMachineBundleWix6"); | ||
| 177 | bundle.Install(); | ||
| 178 | |||
| 179 | bundle.VerifyRegisteredAndInPackageCache(plannedPerMachine: true); | ||
| 180 | |||
| 181 | var testBAController = this.CreateTestBAController(); | ||
| 182 | testBAController.SetBundleScope(BundleScope.PerMachine); | ||
| 183 | |||
| 184 | var bundleV2 = this.CreateBundleInstaller("PerMachineBundleV2"); | ||
| 185 | var log = bundleV2.Install(); | ||
| 186 | Assert.True(LogVerifier.MessageInLogFileRegex(log, @"Upgraded bundle [{][0-9A-Fa-f\-]{36}[}] was already installed with scope: PerMachine\. Scope cannot change during upgrade\.")); | ||
| 187 | |||
| 188 | bundleV2.Uninstall(); | ||
| 189 | bundleV2.VerifyUnregisteredAndRemovedFromPackageCache(plannedPerMachine: true); | ||
| 190 | bundle.VerifyUnregisteredAndRemovedFromPackageCache(plannedPerMachine: true); | ||
| 191 | } | ||
| 192 | |||
| 193 | [RuntimeFact] | ||
| 154 | public void PMOU_Bundle_Default_Plan_Installs_PerMachine() | 194 | public void PMOU_Bundle_Default_Plan_Installs_PerMachine() |
| 155 | { | 195 | { |
| 156 | var testBAController = this.CreateTestBAController(); | 196 | var testBAController = this.CreateTestBAController(); |
diff --git a/src/test/burn/test_burn.cmd b/src/test/burn/test_burn.cmd index a956c838..3f03216b 100644 --- a/src/test/burn/test_burn.cmd +++ b/src/test/burn/test_burn.cmd | |||
| @@ -15,6 +15,7 @@ | |||
| 15 | 15 | ||
| 16 | msbuild -Restore -p:Configuration=%_C% -tl -nologo -m -warnaserror -bl:%_L%\test_burn_build.binlog || exit /b | 16 | msbuild -Restore -p:Configuration=%_C% -tl -nologo -m -warnaserror -bl:%_L%\test_burn_build.binlog || exit /b |
| 17 | msbuild -Restore TestData\TestData.proj -p:Configuration=%_C% -tl -nologo -m -warnaserror -bl:%_L%\test_burn_data_build.binlog || exit /b | 17 | msbuild -Restore TestData\TestData.proj -p:Configuration=%_C% -tl -nologo -m -warnaserror -bl:%_L%\test_burn_data_build.binlog || exit /b |
| 18 | msbuild -Restore TestData6\TestData6.proj -p:Configuration=%_C% -tl -nologo -m -warnaserror -bl:%_L%\test_burn_data6_build.binlog || exit /b | ||
| 18 | 19 | ||
| 19 | "%_B%\net462\win-x86\testexe.exe" /dm "%_B%\net8.0-windows\testhost.exe" | 20 | "%_B%\net462\win-x86\testexe.exe" /dm "%_B%\net8.0-windows\testhost.exe" |
| 20 | mt.exe -manifest "WixToolsetTest.BurnE2E\testhost.longpathaware.manifest" -updateresource:"%_B%\net8.0-windows\testhost.exe" | 21 | mt.exe -manifest "WixToolsetTest.BurnE2E\testhost.longpathaware.manifest" -updateresource:"%_B%\net8.0-windows\testhost.exe" |
