Skip to content

Commit 2b24344

Browse files
authored
Support ARM64 in rnw-dependencies.ps1
Add ARM64 processor architecture detection for VC Tools component selection Co-authored-by: sundaramramaswamy <29264916+sundaramramaswamy@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: sundaramramaswamy <29264916+sundaramramaswamy@users.noreply.github.com> Fixes microsoft/react-native-gallery#724
1 parent 608e0f0 commit 2b24344

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"type": "prerelease",
3+
"comment": "Fix ARM64 support in rnw-dependencies.ps1 by detecting processor architecture and installing the correct Visual Studio VC Tools component (ARM64 vs x86.x64)",
4+
"packageName": "react-native-windows",
5+
"email": "copilot@github.com",
6+
"dependentChangeType": "patch"
7+
}

vnext/Scripts/rnw-dependencies.ps1

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,36 @@ if ($tagsToInclude.Contains('rnwDev')) {
6262
$tagsToInclude.Add('appDev') | Out-null;
6363
}
6464

65+
# Detect processor architecture to select appropriate VC Tools component
66+
$ProcessorArchitecture = $Env:Processor_Architecture
67+
68+
# Getting $Env:Processor_Architecture on arm64 machines will return x86. So check if the environment
69+
# variable "ProgramFiles(Arm)" is also set, if it is we know the actual processor architecture is arm64.
70+
# The value will also be x86 on amd64 machines when running the x86 version of PowerShell.
71+
if ($ProcessorArchitecture -eq "x86")
72+
{
73+
if ($null -ne ${Env:ProgramFiles(Arm)})
74+
{
75+
$ProcessorArchitecture = "arm64"
76+
}
77+
elseif ($null -ne ${Env:ProgramFiles(x86)})
78+
{
79+
$ProcessorArchitecture = "amd64"
80+
}
81+
}
82+
83+
# Select the appropriate VC Tools component based on processor architecture
84+
if ($ProcessorArchitecture -eq "arm64")
85+
{
86+
$vcToolsComponent = 'Microsoft.VisualStudio.Component.VC.Tools.ARM64'
87+
}
88+
else
89+
{
90+
$vcToolsComponent = 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64'
91+
}
92+
6593
$vsComponents = @('Microsoft.Component.MSBuild',
66-
'Microsoft.VisualStudio.Component.VC.Tools.x86.x64',
94+
$vcToolsComponent,
6795
'Microsoft.VisualStudio.ComponentGroup.UWP.Support',
6896
'Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core',
6997
'Microsoft.VisualStudio.Component.Windows10SDK.19041',

0 commit comments

Comments
 (0)