Skip to content

Commit 730a662

Browse files
ericstjgithub-actions[bot]dougbu
authored
[release/3.1] Backport x64 on ARM64 installer changes (#37409)
* [release/6.0-rc2] Retarget DOTNETHOME when installing x64 on ARM64 (#36695) * Retarget DOTNETHOME when installing x64 on ARM64 * Make platform comparison case insenstive * Address feedback * Install x64 registry keys to different path on ARM64 machine Co-authored-by: Eric StJohn <[email protected]> * Update WiX to signed build (#36865) - #12078 * Update wix to 1.0.0-v3.14.0.5722 (#37329) Co-authored-by: Eric StJohn <[email protected]> * [release/6.0] Use WIX_NATIVE_MACHINE to detect native architecture of target machine (#37335) * Use WIX_NATIVE_MACHINE to detect native architecture of target machine * Reference WIX_NATIVE_MACHINE property Final bit to resolve what I'm tracking in #37290 Co-authored-by: Eric StJohn <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Doug Bunting <[email protected]>
1 parent deab31e commit 730a662

File tree

7 files changed

+114
-3
lines changed

7 files changed

+114
-3
lines changed

eng/targets/Wix.Common.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<PropertyGroup>
55
<SchemaVersion>2.0</SchemaVersion>
66
<ProductVersion>3.14</ProductVersion>
7-
<WixVersion>3.14.0-dotnet</WixVersion>
7+
<WixVersion>1.0.0-v3.14.0.5722</WixVersion>
88
</PropertyGroup>
99

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

2222
<ItemGroup>
23-
<PackageReference Include="Wix" Version="$(WixVersion)" />
23+
<PackageReference Include="Microsoft.Signed.Wix" Version="$(WixVersion)" />
2424
</ItemGroup>
2525

2626
<PropertyGroup>

eng/tools/RepoTasks/RepoTasks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</ItemGroup>
2424

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

2828
<Reference Include="Microsoft.Build" />
2929
<Reference Include="Microsoft.Build.Framework" />
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!-- Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. -->
3+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
4+
<?ifndef Platform?>
5+
<?define Platform = "$(sys.BUILDARCH)"?>
6+
<?endif?>
7+
8+
<!-- InstallerNativeMachine matches the expected values for image file machine constants
9+
https://docs.microsoft.com/en-us/windows/win32/sysinfo/image-file-machine-constants -->
10+
<?if $(var.Platform)~=x86?>
11+
<?define InstallerNativeMachine=332?>
12+
<?elseif $(var.Platform)~=x64?>
13+
<?define InstallerNativeMachine=34404?>
14+
<?elseif $(var.Platform)~=arm64?>
15+
<?define InstallerNativeMachine=43620?>
16+
<?else?>
17+
<?error Unknown platform, $(var.Platform) ?>
18+
<?endif?>
19+
20+
<Fragment>
21+
<!-- Identify when installing in emulation as when WIX_NATIVE_MACHINE does not match the installer
22+
native machine (where supported). Also detect running under WOW on x86 using VersionNT64,
23+
since WIX_NATIVE_MACHINE cannot be retrieved on older Windows builds. -->
24+
<PropertyRef Id="WIX_NATIVE_MACHINE" />
25+
<SetProperty Action="Set_NON_NATIVE_ARCHITECTURE" Id="NON_NATIVE_ARCHITECTURE" Value="true" Before="CostFinalize">
26+
<?if $(var.Platform)~=x86?>
27+
VersionNT64 OR
28+
<?endif?>
29+
WIX_NATIVE_MACHINE AND NOT WIX_NATIVE_MACHINE="$(var.InstallerNativeMachine)"
30+
</SetProperty>
31+
</Fragment>
32+
33+
<?if $(var.Platform)~=x64?>
34+
<Fragment>
35+
<!-- When running in a non-native architecture and user hasn't specified install directory,
36+
install to an x64 subdirectory.
37+
This is only define for x64, since x86 has redirection and no other native architecture can install ARM64 today -->
38+
<SetProperty Action="Set_DOTNETHOME_NON_NATIVE_ARCHITECTURE" Id="DOTNETHOME" Value="[ProgramFiles64Folder]dotnet\x64\" After="Set_NON_NATIVE_ARCHITECTURE">
39+
NON_NATIVE_ARCHITECTURE AND NOT DOTNETHOME
40+
</SetProperty>
41+
</Fragment>
42+
<?endif?>
43+
</Wix>

src/Installers/Windows/SharedFramework/Product.wxs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
</Directory>
3636
</Directory>
3737
</Directory>
38+
39+
<?if $(var.Platform)=x64?>
40+
<CustomActionRef Id="Set_DOTNETHOME_NON_NATIVE_ARCHITECTURE" />
41+
<?endif?>
3842
</Fragment>
3943

4044
<Fragment>
@@ -52,6 +56,10 @@
5256
<ComponentRef Id="C_eula.rtf" />
5357
<ComponentRef Id="C_ProductVersion"/>
5458
<ComponentRef Id="C_ProductInstallDir"/>
59+
<?if $(var.Platform)=x64 ?>
60+
<ComponentRef Id="C_ProductVersion_NonNative" />
61+
<ComponentRef Id="C_ProductInstallDir_NonNative" />
62+
<?endif?>
5563
</ComponentGroup>
5664

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

6876
<Component Id="C_ProductVersion">
77+
<?if $(var.Platform)=x64 ?>
78+
<!-- Only install when actually on native architecture -->
79+
<Condition>NOT NON_NATIVE_ARCHITECTURE</Condition>
80+
<?endif?>
6981
<RegistryKey Key="$(var.ProductVersionKey)" Root="HKLM">
7082
<RegistryValue Name="Version" Type="string" Value="$(var.Version)" />
7183
</RegistryKey>
7284
</Component>
7385

7486
<Component Id="C_ProductInstallDir">
87+
<?if $(var.Platform)=x64 ?>
88+
<!-- Only install when actually on native architecture -->
89+
<Condition>NOT NON_NATIVE_ARCHITECTURE</Condition>
90+
<?endif?>
7591
<RegistryKey Key="SOFTWARE\Microsoft\ASP.NET Core\Shared Framework" Root="HKLM">
7692
<RegistryValue Name="InstallDir" Type="string" Value="[DOTNETHOME]" />
7793
</RegistryKey>
7894
</Component>
95+
96+
<?if $(var.Platform)=x64 ?>
97+
<!-- Install keys to a different path when not native architecture -->
98+
<Component Id="C_ProductVersion_NonNative">
99+
<Condition>NON_NATIVE_ARCHITECTURE</Condition>
100+
<RegistryKey Key="$(var.ProductVersionKey)\$(var.Platform)" Root="HKLM">
101+
<RegistryValue Name="Version" Type="string" Value="$(var.Version)" />
102+
</RegistryKey>
103+
</Component>
104+
105+
<Component Id="C_ProductInstallDir_NonNative">
106+
<Condition>NON_NATIVE_ARCHITECTURE</Condition>
107+
<RegistryKey Key="SOFTWARE\Microsoft\ASP.NET Core\Shared Framework\$(var.Platform)" Root="HKLM">
108+
<RegistryValue Name="InstallDir" Type="string" Value="[DOTNETHOME]" />
109+
</RegistryKey>
110+
</Component>
111+
<?endif?>
79112
</DirectoryRef>
80113
</Fragment>
81114
</Wix>

src/Installers/Windows/SharedFramework/SharedFramework.wixproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
<ItemGroup>
4747
<Compile Include="DependencyProvider.wxs" />
4848
<Compile Include="Product.wxs" />
49+
<Compile Include="..\Common\dotnethome_x64.wxs" Link="dotnethome_x64.wxs" />
4950
<EmbeddedResource Include="Strings.wxl" />
5051
</ItemGroup>
5152

src/Installers/Windows/TargetingPack/Product.wxs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
<Directory Id="DOTNETHOME" Name="dotnet" />
3434
</Directory>
3535
</Directory>
36+
37+
<?if $(var.Platform)=x64?>
38+
<CustomActionRef Id="Set_DOTNETHOME_NON_NATIVE_ARCHITECTURE" />
39+
<?endif?>
3640
</Fragment>
3741

3842
<Fragment>
@@ -49,6 +53,10 @@
4953
<ComponentGroup Id="CG_ProductInfo">
5054
<ComponentRef Id="C_ProductVersion"/>
5155
<ComponentRef Id="C_ProductInstallDir"/>
56+
<?if $(var.Platform)=x64 ?>
57+
<ComponentRef Id="C_ProductVersion_NonNative"/>
58+
<ComponentRef Id="C_ProductInstallDir_NonNative"/>
59+
<?endif?>
5260
</ComponentGroup>
5361

5462
<DirectoryRef Id="DOTNETHOME">
@@ -59,16 +67,41 @@
5967
<?define ProductVersionKey=SOFTWARE\Microsoft\ASP.NET Core\Targeting Pack\v$(var.MajorVersion).$(var.MinorVersion)\$(var.PackageVersion)?>
6068

6169
<Component Id="C_ProductVersion">
70+
<?if $(var.Platform)=x64 ?>
71+
<!-- Only install when actually on native architecture -->
72+
<Condition>NOT NON_NATIVE_ARCHITECTURE</Condition>
73+
<?endif?>
6274
<RegistryKey Key="$(var.ProductVersionKey)" Root="HKLM">
6375
<RegistryValue Name="Version" Type="string" Value="$(var.Version)" />
6476
</RegistryKey>
6577
</Component>
6678

6779
<Component Id="C_ProductInstallDir">
80+
<?if $(var.Platform)=x64 ?>
81+
<!-- Only install when actually on native architecture -->
82+
<Condition>NOT NON_NATIVE_ARCHITECTURE</Condition>
83+
<?endif?>
6884
<RegistryKey Key="SOFTWARE\Microsoft\ASP.NET Core\Targeting Pack" Root="HKLM">
6985
<RegistryValue Name="InstallDir" Type="string" Value="[DOTNETHOME]" />
7086
</RegistryKey>
7187
</Component>
88+
89+
90+
<?if $(var.Platform)=x64 ?>
91+
<!-- Install keys to a different path when not native architecture -->
92+
<Component Id="C_ProductVersion_NonNative">
93+
<Condition>NON_NATIVE_ARCHITECTURE</Condition>
94+
<RegistryKey Key="$(var.ProductVersionKey)\$(var.Platform)" Root="HKLM">
95+
<RegistryValue Name="Version" Type="string" Value="$(var.Version)" />
96+
</RegistryKey>
97+
</Component>
98+
<Component Id="C_ProductInstallDir_NonNative">
99+
<Condition>NON_NATIVE_ARCHITECTURE</Condition>
100+
<RegistryKey Key="SOFTWARE\Microsoft\ASP.NET Core\Targeting Pack\$(var.Platform)" Root="HKLM">
101+
<RegistryValue Name="InstallDir" Type="string" Value="[DOTNETHOME]" />
102+
</RegistryKey>
103+
</Component>
104+
<?endif?>
72105
</DirectoryRef>
73106
</Fragment>
74107
</Wix>

src/Installers/Windows/TargetingPack/TargetingPack.wixproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<ItemGroup>
4949
<Compile Include="DependencyProvider.wxs" />
5050
<Compile Include="Product.wxs" />
51+
<Compile Include="..\Common\dotnethome_x64.wxs" Link="dotnethome_x64.wxs" />
5152
<EmbeddedResource Include="Strings.wxl" />
5253
</ItemGroup>
5354

0 commit comments

Comments
 (0)