Merge in 'release/6.0.4xx' changes

This commit is contained in:
dotnet-bot 2022-11-03 23:02:09 +00:00
commit 43de9f5630
2 changed files with 40 additions and 18 deletions

View file

@ -396,7 +396,17 @@ extern "C" HRESULT DetectSdk(LPWSTR sczSdkFeatureBandVersion, LPWSTR sczArchitec
LogStringLine(REPORT_STANDARD, "Scanning %ls", sczInstalledSdkVersionsKeyName);
hr = RegOpen(HKEY_LOCAL_MACHINE, sczInstalledSdkVersionsKeyName, KEY_READ, &hkInstalledSdkVersionsKey);
ExitOnFailure(hr, "Failed to read installed versions key.");
// When the last SDK is removed the registry key should no longer exist so we can just exit
if (E_FILENOTFOUND == hr)
{
LogStringLine(REPORT_STANDARD, "Registry key not found: %ls.", sczInstalledSdkVersionsKeyName);
hr = S_OK;
*pbInstalled = FALSE;
goto LExit;
}
ExitOnFailure(hr, "Failed to open registry key: %ls.", sczInstalledSdkVersionsKeyName);
for (DWORD dwSdkVersionsValueIndex = 0;; ++dwSdkVersionsValueIndex)
{
@ -460,9 +470,10 @@ int wmain(int argc, wchar_t* argv[])
hr = ::DetectSdk(sczFeatureBandVersion, argv[3], &bSdkFeatureBandInstalled);
ExitOnFailure(hr, "Failed to detect installed SDKs.");
if (!bSdkFeatureBandInstalled)
// If the feature band is still present, do not remove workloads.
if (bSdkFeatureBandInstalled)
{
LogStringLine(REPORT_STANDARD, "SDK with feature band %ls could not be found.", sczFeatureBandVersion);
LogStringLine(REPORT_STANDARD, "Detected SDK with feature band %ls.", sczFeatureBandVersion);
goto LExit;
}

View file

@ -151,7 +151,31 @@
<Variable Name="WINFORMSANDWPFVERSION" Type="string" Value="$(var.WinFormsAndWpfVersion)" bal:Overridable="no" />
<Variable Name="DOTNETHOMESIMILARITYCHECKOVERRIDE" Type="string" Value="" bal:Overridable="yes" />
<Chain DisableSystemRestore="yes" ParallelCache="yes">
<Chain DisableSystemRestore="yes" ParallelCache="yes">
<!--
The finalizer is not an actual installation package. We "detect" the EXE
based on the action the bundle is performing to ensure that it runs the uninstall
command only when the bundle is being removed. The package is always installable because the bundle
will remove the package (execute its UninstallCommand) if it is not installable when then bundle is
being installed.
The finalizer is first in the chain to ensure it executes last during an uninstall. When the
SDK is upgraded, the old SDK will be removed before the finalizer executes. This ensures that the
finalizer detects the new SDK and does nothing because the feature band matches.
For an install+uninstall scenario, because the SDK MSI is removed prior to the finalizer, it will
detect that there are no matching feature bands and then clean up workloads associated with
the feature band.
-->
<ExePackage SourceFile="$(var.FinalizerExeSourcePath)"
Cache="always"
DetectCondition="WixBundleAction >= 3"
Id="Finalizer"
InstallCondition="WixBundleAction >= 4"
UninstallCommand="&quot;[WixBundleLog_Finalizer]&quot; $(var.NugetVersion) $(var.Platform)"
Vital="no" />
<MsiPackage SourceFile="$(var.SharedFXMsiSourcePath)">
<MsiProperty Name="DOTNETHOME" Value="[DOTNETHOME]" />
</MsiPackage>
@ -208,20 +232,7 @@
<PackageGroupRef Id="PG_AspNetCoreSharedFramework_arm64"/>
<?endif?>
<!--
The finalizer is not an actual installation package. We "detect" the EXE
based on the action the bundle is performing to ensure that it runs the uninstall
command only when the bundle is being removed. The package is always installable because the bundle
will remove (execute the uninstall command) the package if it is not installable when then bundle is
being installed.
-->
<ExePackage SourceFile="$(var.FinalizerExeSourcePath)"
Cache="always"
DetectCondition="WixBundleAction >= 3"
Id="Finalizer"
InstallCondition="WixBundleAction >= 4"
UninstallCommand="&quot;[WixBundleLog_Finalizer]&quot; $(var.NugetVersion) $(var.Platform)"
Vital="no" />
</Chain>
</Bundle>