-
Notifications
You must be signed in to change notification settings - Fork 437
Retarget DOTNETHOME when installing x64 on ARM64 #11843
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
Changes from all commits
efcf8a5
cf2914d
7719249
2fa338a
18e3759
58615fc
4ce025c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| <?xml version="1.0" encoding="utf-8"?> | ||
| <!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. --> | ||
| <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> | ||
| <?ifndef Platform?> | ||
| <?define Platform = "$(sys.BUILDARCH)"?> | ||
| <?endif?> | ||
|
|
||
| <!-- InstallerArchitecture matches the expected values for PROCESSOR_ARCHITECTURE | ||
| https://docs.microsoft.com/en-us/windows/win32/winprog64/wow64-implementation-details --> | ||
| <?if $(var.Platform)~=x86?> | ||
| <?define InstallerArchitecture="X86"?> | ||
| <?elseif $(var.Platform)~=x64?> | ||
| <?define InstallerArchitecture="AMD64"?> | ||
| <?elseif $(var.Platform)~=arm64?> | ||
| <?define InstallerArchitecture="ARM64"?> | ||
| <?else?> | ||
| <?error Unknown platform, $(var.Platform) ?>? | ||
| <?endif?> | ||
|
|
||
| <Fragment> | ||
| <!-- Identify when installing in emulation as when PROCESSOR_ARCHITECTURE does not match the installer architecture | ||
| https://docs.microsoft.com/en-us/windows/win32/winprog64/wow64-implementation-details --> | ||
| <SetProperty Action="Set_NON_NATIVE_ARCHITECTURE" Id="NON_NATIVE_ARCHITECTURE" Value="true" Before="CostFinalize"> | ||
| NOT %PROCESSOR_ARCHITECTURE="$(var.InstallerArchitecture)" | ||
| </SetProperty> | ||
| </Fragment> | ||
|
|
||
| <?if $(var.Platform)~=x64?> | ||
| <Fragment> | ||
| <!-- When running in a non-native architecture and user hasn't specified install directory, | ||
| install to an x64 subdirectory. | ||
| This is only define for x64, since x86 has redirection and no other native architecture can install ARM64 today --> | ||
| <SetProperty Action="Set_DOTNETHOME_NON_NATIVE_ARCHITECTURE" Id="DOTNETHOME" Value="[ProgramFiles64Folder]dotnet\x64\" After="Set_NON_NATIVE_ARCHITECTURE"> | ||
| NON_NATIVE_ARCHITECTURE AND NOT DOTNETHOME | ||
| </SetProperty> | ||
| </Fragment> | ||
| <?endif?> | ||
| </Wix> |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,5 +34,47 @@ | |
| </RegistryKey> | ||
| </Component> | ||
| </ComponentGroup> | ||
|
|
||
| <!-- Set values for DOTNETHOME if not passed in. | ||
| These searches prefer the existing registry key and fallback to probing the default location if registry key isn't present --> | ||
| <Property Id="DOTNETHOME_X86_SEARCH"> | ||
| <DirectorySearch Id="dirDOTNETHOME_X86_search" Path="[ProgramFilesFolder]dotnet" AssignToProperty="yes"> | ||
| <FileSearch Id="fileDOTNETHOME_X86_search" Name="dotnet.exe" /> | ||
| </DirectorySearch> | ||
| <RegistrySearch Id="regDOTNETHOME_X86_search" Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\x86" Name="InstallLocation" Win64="no" Type="raw" /> | ||
| </Property> | ||
| <Property Id="DOTNETHOME_X64_SEARCH"> | ||
| <DirectorySearch Id="dirDOTNETHOME_X64_search" Path="[ProgramFiles64Folder]dotnet" AssignToProperty="yes"> | ||
| <FileSearch Id="fileDOTNETHOME_X64_search" Name="dotnet.exe" /> | ||
| </DirectorySearch> | ||
| <RegistrySearch Id="regDOTNETHOME_X64_search" Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\x64" Name="InstallLocation" Win64="no" Type="raw" /> | ||
| </Property> | ||
| <Property Id="DOTNETHOME_X64_ALT_SEARCH"> | ||
| <DirectorySearch Id="dirDOTNETHOME_X64_ALT_search" Path="[ProgramFiles64Folder]dotnet\x64" AssignToProperty="yes"> | ||
| <FileSearch Id="fileDOTNETHOME_X64_ALT_search" Name="dotnet.exe" /> | ||
| </DirectorySearch> | ||
| <RegistrySearch Id="regDOTNETHOME_X64_ALT_search" Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\x64" Name="InstallLocation" Win64="no" Type="raw" /> | ||
| </Property> | ||
| <Property Id="DOTNETHOME_ARM64_SEARCH"> | ||
| <DirectorySearch Id="dirDOTNETHOME_ARM64_search" Path="[ProgramFiles64Folder]dotnet" AssignToProperty="yes"> | ||
| <FileSearch Id="fileDOTNETHOME_ARM64_search" Name="dotnet.exe" /> | ||
| </DirectorySearch> | ||
| <RegistrySearch Id="regDOTNETHOME_ARM64_search" Root="HKLM" Key="SOFTWARE\dotnet\Setup\InstalledVersions\arm64" Name="InstallLocation" Win64="no" Type="raw" /> | ||
| </Property> | ||
|
|
||
| <!-- Set the DOTNETHOME property if not passed in and we found a path --> | ||
| <SetProperty Id="DOTNETHOME_X86" Value="[DOTNETHOME_X86_SEARCH]" Before="CostFinalize"> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I got this. The only time we'd be in trouble is a clean install, where the bundle fails to pass DOTNETHOME_xxx and the search won't find anything because we've never been installed and that would technically point to an authoring error. I need to check how the SDK is authored into VS because there VS takes the place of the bundle to pass in DOTNET_HOME to the MSI
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We shouldn't have to pass in defaults. A clean install won't detect it as it runs searches up front in the bundle. We can run similar searches here so that we detect it after the host was installed. The bundle's searches miss this because they run before the host is installed. In general we have to be very careful when using public properties to control installed content: think through all scenarios of install/repair/patch(if supported)/uninstall/upgrade to make sure property values are correct. Never count on the MSI being "called correctly" to get that stuff right.
We should remove those. The meaning of |
||
| NOT DOTNETHOME_X86 AND DOTNETHOME_X86_SEARCH | ||
| </SetProperty> | ||
| <SetProperty Id="DOTNETHOME_X64" Value="[DOTNETHOME_X64_SEARCH]" Before="CostFinalize"> | ||
| NOT DOTNETHOME_X64 AND DOTNETHOME_X64_SEARCH AND %PROCESSOR_ARCHITECTURE="AMD64" | ||
| </SetProperty> | ||
| <SetProperty Action="Set_DOTNETHOME_X64_alt" Id="DOTNETHOME_X64" Value="[DOTNETHOME_X64_ALT_SEARCH]" Before="CostFinalize"> | ||
| NOT DOTNETHOME_X64 AND DOTNETHOME_X64_ALT_SEARCH AND NOT %PROCESSOR_ARCHITECTURE="AMD64" | ||
| </SetProperty> | ||
| <SetProperty Id="DOTNETHOME_ARM64" Value="[DOTNETHOME_ARM64_SEARCH]" Before="CostFinalize"> | ||
| NOT DOTNETHOME_ARM64 AND DOTNETHOME_ARM64_SEARCH | ||
| </SetProperty> | ||
|
|
||
| </Fragment> | ||
| </Wix> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that I special cased this condition because all the existing SDKs already write keys for x64 and ARM64 on Windows. The value for ARM64 on an x64 machine is innocuous, since it exists and won't cause any bad behavior, unless windows finds a way to let ARM64 code run on x64 😆
There is a more annoying pathological bug as a result of this, but I'd like to peel that off. See #11999