Skip to content

Commit 4f44236

Browse files
committed
Install x64 registry keys to different path on ARM64 machine
1 parent 0dbeb66 commit 4f44236

File tree

2 files changed

+58
-8
lines changed

2 files changed

+58
-8
lines changed

src/Installers/Windows/SharedFramework/Product.wxs

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
<ComponentRef Id="C_eula.rtf" />
5757
<ComponentRef Id="C_ProductVersion"/>
5858
<ComponentRef Id="C_ProductInstallDir"/>
59+
<?if $(var.Platform)=x64 ?>
60+
<ComponentRef Id="C_ProductVersion_NonNative" />
61+
<ComponentRef Id="C_ProductInstallDir_NonNative" />
62+
<?endif?>
5963
</ComponentGroup>
6064

6165
<DirectoryRef Id="SharedFolder">
@@ -67,23 +71,44 @@
6771
<?undef ProductVersionKey?>
6872
<?endif?>
6973

70-
<!-- TODO: the following keys will collide between x64 and ARM64.
71-
They are actually *already* colliding between x86 and x64 since these will be writing to the x86 registry hive.
72-
Any interest in fixing this? -->
73-
7474
<?define ProductVersionKey=SOFTWARE\Microsoft\ASP.NET Core\Shared Framework\v$(var.MajorVersion).$(var.MinorVersion)\$(var.PackageVersion)?>
7575

7676
<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?>
7781
<RegistryKey Key="$(var.ProductVersionKey)" Root="HKLM">
7882
<RegistryValue Name="Version" Type="string" Value="$(var.Version)" />
7983
</RegistryKey>
8084
</Component>
8185

8286
<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?>
8391
<RegistryKey Key="SOFTWARE\Microsoft\ASP.NET Core\Shared Framework" Root="HKLM">
8492
<RegistryValue Name="InstallDir" Type="string" Value="[DOTNETHOME]" />
8593
</RegistryKey>
8694
</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?>
87112
</DirectoryRef>
88113
</Fragment>
89114
</Wix>

src/Installers/Windows/TargetingPack/Product.wxs

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,30 +59,55 @@
5959
<ComponentGroup Id="CG_ProductInfo">
6060
<ComponentRef Id="C_ProductVersion"/>
6161
<ComponentRef Id="C_ProductInstallDir"/>
62+
<?if $(var.Platform)=x64 ?>
63+
<ComponentRef Id="C_ProductVersion_NonNative"/>
64+
<ComponentRef Id="C_ProductInstallDir_NonNative"/>
65+
<?endif?>
6266
</ComponentGroup>
6367

6468
<DirectoryRef Id="DOTNETHOME">
6569
<?ifdef ProductVersionKey?>
6670
<?undef ProductVersionKey?>
6771
<?endif?>
6872

69-
<!-- TODO: the following keys will collide between x64 and ARM64.
70-
They are actually *already* colliding between x86 and x64 since these will be writing to the x86 registry hive.
71-
Any interest in fixing this? -->
72-
7373
<?define ProductVersionKey=SOFTWARE\Microsoft\ASP.NET Core\Targeting Pack\v$(var.MajorVersion).$(var.MinorVersion)\$(var.PackageVersion)?>
7474

7575
<Component Id="C_ProductVersion">
76+
<?if $(var.Platform)=x64 ?>
77+
<!-- Only install when actually on native architecture -->
78+
<Condition>NOT NON_NATIVE_ARCHITECTURE</Condition>
79+
<?endif?>
7680
<RegistryKey Key="$(var.ProductVersionKey)" Root="HKLM">
7781
<RegistryValue Name="Version" Type="string" Value="$(var.Version)" />
7882
</RegistryKey>
7983
</Component>
8084

8185
<Component Id="C_ProductInstallDir">
86+
<?if $(var.Platform)=x64 ?>
87+
<!-- Only install when actually on native architecture -->
88+
<Condition>NOT NON_NATIVE_ARCHITECTURE</Condition>
89+
<?endif?>
8290
<RegistryKey Key="SOFTWARE\Microsoft\ASP.NET Core\Targeting Pack" Root="HKLM">
8391
<RegistryValue Name="InstallDir" Type="string" Value="[DOTNETHOME]" />
8492
</RegistryKey>
8593
</Component>
94+
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+
<Component Id="C_ProductInstallDir_NonNative">
105+
<Condition>NON_NATIVE_ARCHITECTURE</Condition>
106+
<RegistryKey Key="SOFTWARE\Microsoft\ASP.NET Core\Targeting Pack\$(var.Platform)" Root="HKLM">
107+
<RegistryValue Name="InstallDir" Type="string" Value="[DOTNETHOME]" />
108+
</RegistryKey>
109+
</Component>
110+
<?endif?>
86111
</DirectoryRef>
87112
</Fragment>
88113
</Wix>

0 commit comments

Comments
 (0)