Skip to content

[release/6.0-rc2] Retarget DOTNETHOME when installing x64 on ARM64 #36695

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

Merged
merged 4 commits into from
Sep 20, 2021
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
38 changes: 38 additions & 0 deletions src/Installers/Windows/Common/dotnethome_x64.wxs
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>
33 changes: 33 additions & 0 deletions src/Installers/Windows/SharedFramework/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
</Directory>
</Directory>
</Directory>

<?if $(var.Platform)=x64?>
<CustomActionRef Id="Set_DOTNETHOME_NON_NATIVE_ARCHITECTURE" />
<?endif?>
</Fragment>

<Fragment>
Expand All @@ -52,6 +56,10 @@
<ComponentRef Id="C_eula.rtf" />
<ComponentRef Id="C_ProductVersion"/>
<ComponentRef Id="C_ProductInstallDir"/>
<?if $(var.Platform)=x64 ?>
<ComponentRef Id="C_ProductVersion_NonNative" />
<ComponentRef Id="C_ProductInstallDir_NonNative" />
<?endif?>
</ComponentGroup>

<DirectoryRef Id="SharedFolder">
Expand All @@ -66,16 +74,41 @@
<?define ProductVersionKey=SOFTWARE\Microsoft\ASP.NET Core\Shared Framework\v$(var.MajorVersion).$(var.MinorVersion)\$(var.PackageVersion)?>

<Component Id="C_ProductVersion">
<?if $(var.Platform)=x64 ?>
<!-- Only install when actually on native architecture -->
<Condition>NOT NON_NATIVE_ARCHITECTURE</Condition>
<?endif?>
<RegistryKey Key="$(var.ProductVersionKey)" Root="HKLM">
<RegistryValue Name="Version" Type="string" Value="$(var.Version)" />
</RegistryKey>
</Component>

<Component Id="C_ProductInstallDir">
<?if $(var.Platform)=x64 ?>
<!-- Only install when actually on native architecture -->
<Condition>NOT NON_NATIVE_ARCHITECTURE</Condition>
<?endif?>
<RegistryKey Key="SOFTWARE\Microsoft\ASP.NET Core\Shared Framework" Root="HKLM">
<RegistryValue Name="InstallDir" Type="string" Value="[DOTNETHOME]" />
</RegistryKey>
</Component>

<?if $(var.Platform)=x64 ?>
<!-- Install keys to a different path when not native architecture -->
<Component Id="C_ProductVersion_NonNative">
<Condition>NON_NATIVE_ARCHITECTURE</Condition>
<RegistryKey Key="$(var.ProductVersionKey)\$(var.Platform)" Root="HKLM">
<RegistryValue Name="Version" Type="string" Value="$(var.Version)" />
</RegistryKey>
</Component>

<Component Id="C_ProductInstallDir_NonNative">
<Condition>NON_NATIVE_ARCHITECTURE</Condition>
<RegistryKey Key="SOFTWARE\Microsoft\ASP.NET Core\Shared Framework\$(var.Platform)" Root="HKLM">
<RegistryValue Name="InstallDir" Type="string" Value="[DOTNETHOME]" />
</RegistryKey>
</Component>
<?endif?>
</DirectoryRef>
</Fragment>
</Wix>
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
<ItemGroup>
<Compile Include="DependencyProvider.wxs" />
<Compile Include="Product.wxs" />
<Compile Include="..\Common\dotnethome_x64.wxs" Link="dotnethome_x64.wxs" />
<EmbeddedResource Include="Strings.wxl" />
</ItemGroup>

Expand Down
33 changes: 33 additions & 0 deletions src/Installers/Windows/TargetingPack/Product.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
<Directory Id="DOTNETHOME" Name="dotnet" />
</Directory>
</Directory>

<?if $(var.Platform)=x64?>
<CustomActionRef Id="Set_DOTNETHOME_NON_NATIVE_ARCHITECTURE" />
<?endif?>
</Fragment>

<Fragment>
Expand All @@ -55,6 +59,10 @@
<ComponentGroup Id="CG_ProductInfo">
<ComponentRef Id="C_ProductVersion"/>
<ComponentRef Id="C_ProductInstallDir"/>
<?if $(var.Platform)=x64 ?>
<ComponentRef Id="C_ProductVersion_NonNative"/>
<ComponentRef Id="C_ProductInstallDir_NonNative"/>
<?endif?>
</ComponentGroup>

<DirectoryRef Id="DOTNETHOME">
Expand All @@ -65,16 +73,41 @@
<?define ProductVersionKey=SOFTWARE\Microsoft\ASP.NET Core\Targeting Pack\v$(var.MajorVersion).$(var.MinorVersion)\$(var.PackageVersion)?>

<Component Id="C_ProductVersion">
<?if $(var.Platform)=x64 ?>
<!-- Only install when actually on native architecture -->
<Condition>NOT NON_NATIVE_ARCHITECTURE</Condition>
<?endif?>
<RegistryKey Key="$(var.ProductVersionKey)" Root="HKLM">
<RegistryValue Name="Version" Type="string" Value="$(var.Version)" />
</RegistryKey>
</Component>

<Component Id="C_ProductInstallDir">
<?if $(var.Platform)=x64 ?>
<!-- Only install when actually on native architecture -->
<Condition>NOT NON_NATIVE_ARCHITECTURE</Condition>
<?endif?>
<RegistryKey Key="SOFTWARE\Microsoft\ASP.NET Core\Targeting Pack" Root="HKLM">
<RegistryValue Name="InstallDir" Type="string" Value="[DOTNETHOME]" />
</RegistryKey>
</Component>


<?if $(var.Platform)=x64 ?>
<!-- Install keys to a different path when not native architecture -->
<Component Id="C_ProductVersion_NonNative">
<Condition>NON_NATIVE_ARCHITECTURE</Condition>
<RegistryKey Key="$(var.ProductVersionKey)\$(var.Platform)" Root="HKLM">
<RegistryValue Name="Version" Type="string" Value="$(var.Version)" />
</RegistryKey>
</Component>
<Component Id="C_ProductInstallDir_NonNative">
<Condition>NON_NATIVE_ARCHITECTURE</Condition>
<RegistryKey Key="SOFTWARE\Microsoft\ASP.NET Core\Targeting Pack\$(var.Platform)" Root="HKLM">
<RegistryValue Name="InstallDir" Type="string" Value="[DOTNETHOME]" />
</RegistryKey>
</Component>
<?endif?>
</DirectoryRef>
</Fragment>
</Wix>
1 change: 1 addition & 0 deletions src/Installers/Windows/TargetingPack/TargetingPack.wixproj
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
<ItemGroup>
<Compile Include="DependencyProvider.wxs" />
<Compile Include="Product.wxs" />
<Compile Include="..\Common\dotnethome_x64.wxs" Link="dotnethome_x64.wxs" />
<EmbeddedResource Include="Strings.wxl" />
</ItemGroup>

Expand Down