Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add registry search for upgrade policy keys #14975

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@
</bal:Condition>
<?endif?>

<!-- Search references for upgrade policy keys -->
<util:RegistrySearchRef Id="RemovePreviousVersionRegistryKeySearch"/>
<util:RegistrySearchRef Id="RemoveSpecificPreviousVersionRegistryKeyExistsSearch"/>
<util:RegistrySearchRef Id="RemoveSpecificPreviousVersionRegistryKeySearch"/>

<!--
List of bundles that this bundle is an upgrade for. Used to support upgrade from bundles
that were produced before UpdateCode was standardized per major-minor channel.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Fragment>
<!-- Bundle variables become unset if a search fails. The global key is retrieved first. If this fails,
RemoveUpgradeRelatedBundle becomes unset, allowing the version specific search to potentially set
or override the bundle variable. -->
<util:RegistrySearch Id="RemovePreviousVersionRegistryKeySearch"
Root="HKLM"
Key="SOFTWARE\Microsoft\.NET"
Value="RemovePreviousVersion"
Result="value"
Variable="RemoveUpgradeRelatedBundle"
Win64="yes" />

<!-- The version specific key matching the major/minor of the .NET bundle takes precedence. The first search
checks whether the registry value exists and creates a variable that can be used as a condition
to executes the second part of the search to retrieve it. If the value doesn't exist, RemoveUpgradeRelatedBundle
retains its original value, or if it wasn't set, will be assigned a proper default through the BA (wixstdba). -->
<util:RegistrySearch Id="RemoveSpecificPreviousVersionRegistryKeyExistsSearch"
After="RemovePreviousVersionRegistryKeySearch"
Root="HKLM"
Key="SOFTWARE\Microsoft\.NET\$(var.MajorVersion).$(var.MinorVersion)"
Value="RemovePreviousVersion"
Result="exists"
Variable="RemoveSpecificPreviousVersionRegistryKeyExists"
Win64="yes" />
<util:RegistrySearch Id="RemoveSpecificPreviousVersionRegistryKeySearch"
After="RemoveSpecificPreviousVersionRegistryKeyExistsSearch"
Condition="RemoveSpecificPreviousVersionRegistryKeyExists=1"
Root="HKLM"
Key="SOFTWARE\Microsoft\.NET\$(var.MajorVersion).$(var.MinorVersion)"
Value="RemovePreviousVersion"
Result="value"
Variable="RemoveUpgradeRelatedBundle"
Win64="yes" />
</Fragment>
</Wix>
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@
<WixExtensions Include="WixUtilExtension.dll" />

<WixSrcFile Include="$(MSBuildThisFileDirectory)bundle/bundle.wxs" />
<WixSrcFile Include="$(MSBuildThisFileDirectory)bundle/upgradePolicies.wxs" />
</ItemGroup>
</Target>

Expand Down Expand Up @@ -181,6 +182,8 @@
<LocFile Include="$(BundleThemeDirectory)\theme\**\bundle.wxl" />
<LocDirName Include="$([System.String]::new('%(LocFile.RecursiveDir)').TrimEnd('\'))" />

<CandleVariables Include="MajorVersion" Value="$(MajorVersion)" />
<CandleVariables Include="MinorVersion" Value="$(MinorVersion)" />
<CandleVariables Include="DisplayVersion" Value="$(MajorVersion).$(MinorVersion).$(PatchVersion).$(BuildNumberMajor)" />
<CandleVariables Include="LcidList" Value="@(LocDirName)" />
<CandleVariables Include="BundleThmDir" Value="$(BundleThemeDirectory)" />
Expand Down
Loading