Skip to content
Merged
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
8 changes: 6 additions & 2 deletions src/installer/pkg/sfx/installers/dotnet-host.proj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
34 changes: 30 additions & 4 deletions src/installer/pkg/sfx/installers/host.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,19 @@
</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?>

<!-- A stable keypath with the right SxS characteristics for our PATH entry-->
<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}">
Expand All @@ -63,6 +62,7 @@
</File>
</Component>

<ComponentRef Id="cmpSetPath" />
</ComponentGroup>

<Property Id="ProductCPU" Value="$(var.Platform)" />
Expand All @@ -76,6 +76,32 @@
<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">
<CreateFolder />
<!-- 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 -->
Expand Down