Skip to content

Commit cb06f75

Browse files
committed
Handle lack of scope for pre-v7 bundles.
Fixes wixtoolset/issues#9274
1 parent b4da272 commit cb06f75

File tree

14 files changed

+128
-5
lines changed

14 files changed

+128
-5
lines changed

src/Directory.csproj.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<Project>
44
<PropertyGroup>
5-
<LangVersion Condition=" '$(TargetFrameworkVersion)'=='' ">14.0</LangVersion>
5+
<LangVersion Condition=" '$(TargetFrameworkVersion)'=='' ">13.0</LangVersion>
66
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
77
<SignAssembly>true</SignAssembly>
88
<AssemblyOriginatorKeyFile>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)wix.snk))</AssemblyOriginatorKeyFile>

src/burn/engine/relatedbundle.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,10 +356,19 @@ static HRESULT LoadRelatedBundleFromKey(
356356
LogId(REPORT_WARNING, MSG_RELATED_PACKAGE_INVALID_VERSION, wzRelatedBundleCode, sczBundleVersion);
357357
}
358358

359+
// Look for v7+ scope registration.
359360
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;
361368

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);
363372

364373
hr = RegReadString(hkBundleCode, BURN_REGISTRATION_REGISTRY_BUNDLE_CACHE_PATH, &sczCachePath);
365374
ExitOnFailure(hr, "Failed to read cache path from registry for bundle: %ls", wzRelatedBundleCode);

src/internal/SetBuildNumber/global.json.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"WixToolset.Sdk": "{packageversion}"
77
},
88
"sdk": {
9-
"version": "10.0.100",
9+
"version": "9.0.300",
1010
"rollForward": "latestFeature"
1111
}
1212
}

src/test/burn/TestData/ConfigurableScopeTests/PerMachineBundle/Bundle.wxs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<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)">
33
<BootstrapperApplication>
44
<bal:WixStandardBootstrapperApplication LicenseUrl="https://www.example.com/license" Theme="hyperlinkLicense" />
55
</BootstrapperApplication>
66

7+
<Variable Name="TestBundleId" Value="PerMachineBundle v$(Version)" />
8+
79
<Chain>
810
<MsiPackage SourceFile="PerMachinePkg.msi" />
911
</Chain>

src/test/burn/TestData/ConfigurableScopeTests/PerMachineBundle/PerMachineBundle.wixproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<Project Sdk="WixToolset.Sdk">
22
<PropertyGroup>
33
<OutputType>Bundle</OutputType>
4+
<DefineConstants>$(DefineConstants);Version=1.0.0.0</DefineConstants>
45
</PropertyGroup>
56
<ItemGroup>
67
<PackageReference Include="WixToolset.BootstrapperApplications.wixext" />
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<Project Sdk="WixToolset.Sdk/6.0.2">
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>false</ManagePackageVersionsCentrally>
4+
</PropertyGroup>
5+
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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>

0 commit comments

Comments
 (0)