@@ -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