Skip to content

Commit dcfe5bf

Browse files
authored
Retarget DOTNETHOME when installing x64 on ARM64 (#58669)
1 parent 3fd30b0 commit dcfe5bf

File tree

1 file changed

+31
-6
lines changed
  • src/installer/pkg/sfx/installers

1 file changed

+31
-6
lines changed

src/installer/pkg/sfx/installers/host.wxs

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<Fragment>
77

8-
<ComponentGroup Id="InstallSharedHostandDetectionKeys">
8+
<ComponentGroup Id="InstallSharedHostandDetectionKeys" Directory="DOTNETHOME">
99

1010
<!-- When installing the SharedHost; copy all files to the traditional default install location: 'ProgramFiles'\dotnet even when installing into a custom location.
1111
@@ -20,17 +20,32 @@
2020
1. the legacy SDK can be subsequently installed
2121
2. the user runs 'dotnet' commands directly against 'ProgramFiles'\dotnet\dotnet.exe -->
2222

23-
<Component Id="cmpCoreHost" Directory="DOTNETHOME" Guid="{45399BBB-DDA5-4386-A2E9-618FB3C54A18}" >
23+
<Component Id="cmpCoreHost" Guid="{45399BBB-DDA5-4386-A2E9-618FB3C54A18}" >
2424
<File Id="fileCoreHostExe" KeyPath="yes" Source="$(var.HostSrc)\dotnet.exe">
2525
<CopyFile Id="copyFileCoreHostExe" DestinationDirectory="PROGRAMFILES_DOTNET" />
2626
</File>
27+
</Component>
28+
29+
<Component Id="cmpSharedHostVersionRegistry" Guid="*">
2730
<RegistryKey Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\$(var.Platform)\sharedhost">
28-
<RegistryValue Action="write" Name="Version" Type="string" Value="$(var.NugetVersion)"/>
31+
<RegistryValue KeyPath="yes" Action="write" Name="Version" Type="string" Value="$(var.NugetVersion)"/>
32+
</RegistryKey>
33+
</Component>
34+
35+
<Component Id="cmdPath" Guid="*">
36+
<?if $(var.Platform)~=x64 ?>
37+
<!-- For x64 installer, only add to PATH when actually on native architecture -->
38+
<Condition>NOT NON_NATIVE_ARCHITECTURE</Condition>
39+
<?endif?>
40+
41+
<!-- A stable keypath with the right SxS characteristics for our PATH entry-->
42+
<RegistryKey Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\$(var.Platform)\sharedhost">
43+
<RegistryValue KeyPath="yes" Action="write" Name="Path" Type="string" Value="[DOTNETHOME]"/>
2944
</RegistryKey>
3045
<Environment Id="E_PATH" Name="PATH" Value="[DOTNETHOME]" Part="last" Action="set" System="yes" />
3146
</Component>
3247

33-
<Component Id="cmpLicenseFiles" Directory="DOTNETHOME" Guid="{A61CBE5B-1282-4F29-90AD-63597AA2372E}">
48+
<Component Id="cmpLicenseFiles" Guid="{A61CBE5B-1282-4F29-90AD-63597AA2372E}">
3449
<File Id="fileLicenseTxt" KeyPath="yes" Source="$(var.HostSrc)\LICENSE.txt">
3550
<CopyFile Id="copyFileLicenseTxt" DestinationDirectory="PROGRAMFILES_DOTNET" />
3651
</File>
@@ -47,6 +62,16 @@
4762
<DirectoryRef Id="$(var.Program_Files)">
4863
<Directory Id="PROGRAMFILES_DOTNET" Name="dotnet" />
4964
</DirectoryRef>
65+
66+
<?if $(var.Platform)~=x64 ?>
67+
<CustomActionRef Id="Set_PROGRAMFILES_DOTNET_NON_NATIVE_ARCHITECTURE" />
68+
<?endif?>
5069
</Fragment>
51-
52-
</Wix>
70+
71+
<Fragment>
72+
<!-- Unlike DOTNETHOME which gives precedence to a user specified value over an x64 suffix, here we always want the suffixed path -->
73+
<SetProperty Action="Set_PROGRAMFILES_DOTNET_NON_NATIVE_ARCHITECTURE" Id="PROGRAMFILES_DOTNET" Value="[$(var.Program_Files)]dotnet\x64\" After="Set_NON_NATIVE_ARCHITECTURE">
74+
NON_NATIVE_ARCHITECTURE
75+
</SetProperty>
76+
</Fragment>
77+
</Wix>

0 commit comments

Comments
 (0)