This commit is contained in:
Jacques Eloff 2025-07-30 22:32:37 +08:00 committed by GitHub
commit 610615aae0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 35 additions and 6 deletions

View File

@ -12,7 +12,11 @@
<!-- Contributes to DependencyKey which ensures stable provider key - do not change -->
<WixDependencyKeyName>Dotnet_CLI_SharedHost</WixDependencyKeyName>
<OutputFilesCandleVariable>HostSrc</OutputFilesCandleVariable>
<MajorUpgradeSchedule>afterInstallExecute</MajorUpgradeSchedule>
<!-- Scheduling RemoveExistingProducts after InstallInitialize will remove the previous install first
before installing the new version. This allows compositional changes in major upgrades
and supports rollback, provided it is not turned off using machine policies (DisableRollback is not set to 1). -->
<MajorUpgradeSchedule>afterInstallInitialize</MajorUpgradeSchedule>
<VersionInstallerName>false</VersionInstallerName>
<UseBrandingNameInLinuxPackageDescription>true</UseBrandingNameInLinuxPackageDescription>
<MacOSComponentNamePackType>sharedhost</MacOSComponentNamePackType>
@ -26,7 +30,7 @@
<ItemGroup>
<WixSrcFile Include="host.wxs" />
<WixExtraComponentGroupRefId Include="InstallSharedHostandDetectionKeys" />
<CandleVariables Include="ExtraPropertyRefIds" Value="ProductCPU;RTM_ProductVersion" />
<CandleVariables Include="ExtraPropertyRefIds" Value="ProductCPU;RTM_ProductVersion;DISABLE_SETTING_HOST_PATH" />
<!-- Enables stable provider key - do not change -->
<CandleVariables Include="DependencyKey" Value="$(WixDependencyKeyName)_$(MajorVersion).$(MinorVersion)_$(TargetArchitecture)" />
</ItemGroup>

View File

@ -38,12 +38,12 @@
</RegistryKey>
</Component>
<Component Id="cmdPath" Directory="DOTNETHOME" Guid="*">
<Component Id="cmpPath" Directory="DOTNETHOME" Guid="*">
<?if $(var.Platform)~=x64 ?>
<!-- For x64 installer, only add to PATH when actually on native architecture -->
<!-- For x64 installer, only add the sharedhost key when actually on native architecture. -->
<Condition>NOT NON_NATIVE_ARCHITECTURE</Condition>
<?elseif $(var.Platform)~=x86 ?>
<!-- For x86 installer, only add to PATH when not on 64-bit platform -->
<!-- For x86 installer, only add the key when not on 64-bit platform. -->
<Condition>NOT VersionNT64</Condition>
<?endif?>
@ -51,7 +51,6 @@
<RegistryKey Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\$(var.Platform)\sharedhost">
<RegistryValue KeyPath="yes" Action="write" Name="Path" Type="string" Value="[DOTNETHOME]"/>
</RegistryKey>
<Environment Id="E_PATH" Name="PATH" Value="[DOTNETHOME]" Part="last" Action="set" System="yes" />
</Component>
<Component Id="cmpLicenseFiles" Directory="DOTNETHOME" Guid="{A61CBE5B-1282-4F29-90AD-63597AA2372E}">
@ -63,6 +62,7 @@
</File>
</Component>
<ComponentRef Id="cmpSetPath" />
</ComponentGroup>
<Property Id="ProductCPU" Value="$(var.Platform)" />
@ -76,6 +76,31 @@
<CustomActionRef Id="Set_PROGRAMFILES_DOTNET_NON_NATIVE_ARCHITECTURE" />
<?endif?>
</Fragment>
<Fragment>
<Property Id="DISABLE_SETTING_HOST_PATH" Secure="yes">
<RegistrySearch Id="DisableSettingHostPathSearch" Root="HKLM" Key="SOFTWARE\Microsoft\.NET" Type="raw" Name="DisableSettingHostPath"/>
</Property>
<Component Id="cmpSetPath" Guid="{0B910ED8-0877-473D-8658-647382324433}" Directory="DOTNETHOME">
<!-- Always set the SYSTEM PATH, unless DisableSettingHostPath is 1. -->
<?if $(var.Platform)~=x64 ?>
<!-- For x64 installer, only add to PATH when actually on native architecture. -->
<Condition><![CDATA[DISABLE_SETTING_HOST_PATH <> "#1" AND NOT NON_NATIVE_ARCHITECTURE]]></Condition>
<?elseif $(var.Platform)~=x86 ?>
<!-- For x86 installer, only add to PATH when not on 64-bit platform. -->
<Condition><![CDATA[DISABLE_SETTING_HOST_PATH <> "#1" AND NOT VersionNT64]]></Condition>
<?endif?>
<Environment Id="E_PATH" Name="PATH" Value="[DOTNETHOME]" Part="last" Action="set" System="yes" />
</Component>
<InstallExecuteSequence>
<!-- Only broadcast the change if the component is enabled. -->
<Custom Action="WixBroadcastEnvironmentChange" After="InstallFinalize">
<![CDATA[DISABLE_SETTING_HOST_PATH <> "#1"]]>
</Custom>
</InstallExecuteSequence>
</Fragment>
<Fragment>
<!-- Unlike DOTNETHOME which gives precedence to a user specified value over an x64 suffix, here we always want the suffixed path -->