Skip to content
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
7 changes: 7 additions & 0 deletions change/react-native-windows-1760105341.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "prerelease",
"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)",
"packageName": "react-native-windows",
"email": "[email protected]",
"dependentChangeType": "patch"
}
30 changes: 29 additions & 1 deletion vnext/Scripts/rnw-dependencies.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,36 @@ if ($tagsToInclude.Contains('rnwDev')) {
$tagsToInclude.Add('appDev') | Out-null;
}

# Detect processor architecture to select appropriate VC Tools component
$ProcessorArchitecture = $Env:Processor_Architecture

# Getting $Env:Processor_Architecture on arm64 machines will return x86. So check if the environment
# variable "ProgramFiles(Arm)" is also set, if it is we know the actual processor architecture is arm64.
# The value will also be x86 on amd64 machines when running the x86 version of PowerShell.
if ($ProcessorArchitecture -eq "x86")
{
if ($null -ne ${Env:ProgramFiles(Arm)})
{
$ProcessorArchitecture = "arm64"
}
elseif ($null -ne ${Env:ProgramFiles(x86)})
{
$ProcessorArchitecture = "amd64"
}
}

# Select the appropriate VC Tools component based on processor architecture
if ($ProcessorArchitecture -eq "arm64")
{
$vcToolsComponent = 'Microsoft.VisualStudio.Component.VC.Tools.ARM64'
}
else
{
$vcToolsComponent = 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64'
}

$vsComponents = @('Microsoft.Component.MSBuild',
'Microsoft.VisualStudio.Component.VC.Tools.x86.x64',
$vcToolsComponent,
'Microsoft.VisualStudio.ComponentGroup.UWP.Support',
'Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core',
'Microsoft.VisualStudio.Component.Windows10SDK.19041',
Expand Down
Loading