Skip to content

[release/3.1] Backport x64 on ARM64 installer changes #37409

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
Oct 11, 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
4 changes: 2 additions & 2 deletions eng/targets/Wix.Common.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<ProductVersion>3.14</ProductVersion>
<WixVersion>3.14.0-dotnet</WixVersion>
<WixVersion>1.0.0-v3.14.0.5722</WixVersion>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -20,7 +20,7 @@
<Import Project="$(MSBuildProjectExtensionsPath)$(MSBuildProjectFile).*.props" Condition="'$(_ProjectExtensionsWereImported)' != 'true'" />

<ItemGroup>
<PackageReference Include="Wix" Version="$(WixVersion)" />
<PackageReference Include="Microsoft.Signed.Wix" Version="$(WixVersion)" />
</ItemGroup>

<PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion eng/tools/RepoTasks/RepoTasks.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
<PackageReference Include="Wix" Version="3.11.1" />
<PackageReference Include="Microsoft.Signed.Wix" Version="1.0.0-v3.14.0.5722" />

<Reference Include="Microsoft.Build" />
<Reference Include="Microsoft.Build.Framework" />
Expand Down
43 changes: 43 additions & 0 deletions src/Installers/Windows/Common/dotnethome_x64.wxs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?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?>

<!-- InstallerNativeMachine matches the expected values for image file machine constants
https://docs.microsoft.com/en-us/windows/win32/sysinfo/image-file-machine-constants -->
<?if $(var.Platform)~=x86?>
<?define InstallerNativeMachine=332?>
<?elseif $(var.Platform)~=x64?>
<?define InstallerNativeMachine=34404?>
<?elseif $(var.Platform)~=arm64?>
<?define InstallerNativeMachine=43620?>
<?else?>
<?error Unknown platform, $(var.Platform) ?>
<?endif?>

<Fragment>
<!-- Identify when installing in emulation as when WIX_NATIVE_MACHINE does not match the installer
native machine (where supported). Also detect running under WOW on x86 using VersionNT64,
since WIX_NATIVE_MACHINE cannot be retrieved on older Windows builds. -->
<PropertyRef Id="WIX_NATIVE_MACHINE" />
<SetProperty Action="Set_NON_NATIVE_ARCHITECTURE" Id="NON_NATIVE_ARCHITECTURE" Value="true" Before="CostFinalize">
<?if $(var.Platform)~=x86?>
VersionNT64 OR
<?endif?>
WIX_NATIVE_MACHINE AND NOT WIX_NATIVE_MACHINE="$(var.InstallerNativeMachine)"
</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 @@ -33,6 +33,10 @@
<Directory Id="DOTNETHOME" Name="dotnet" />
</Directory>
</Directory>

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

<Fragment>
Expand All @@ -49,6 +53,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 @@ -59,16 +67,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