@@ -211,12 +211,12 @@ function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $arc
211211 InstallDotNet - dotnetRoot $dotnetRoot - version $version - architecture $architecture - skipNonVersionedFiles $false - runtimeSourceFeed $runtimeSourceFeed - runtimeSourceFeedKey $runtimeSourceFeedKey
212212}
213213
214- function InstallDotNet ([string ] $dotnetRoot ,
215- [string ] $version ,
216- [string ] $architecture = " " ,
217- [string ] $runtime = " " ,
218- [bool ] $skipNonVersionedFiles = $false ,
219- [string ] $runtimeSourceFeed = " " ,
214+ function InstallDotNet ([string ] $dotnetRoot ,
215+ [string ] $version ,
216+ [string ] $architecture = " " ,
217+ [string ] $runtime = " " ,
218+ [bool ] $skipNonVersionedFiles = $false ,
219+ [string ] $runtimeSourceFeed = " " ,
220220 [string ] $runtimeSourceFeedKey = " " ) {
221221
222222 $installScript = GetDotNetInstallScript $dotnetRoot
@@ -323,7 +323,16 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements =
323323 }
324324
325325 $msbuildVersionDir = if ([int ]$vsMajorVersion -lt 16 ) { " $vsMajorVersion .0" } else { " Current" }
326- return $global :_MSBuildExe = Join-Path $vsInstallDir " MSBuild\$msbuildVersionDir \Bin\msbuild.exe"
326+
327+ $local :BinFolder = Join-Path $vsInstallDir " MSBuild\$msbuildVersionDir \Bin"
328+ $local :Prefer64bit = if (Get-Member - InputObject $vsRequirements - Name ' Prefer64bit' ) { $vsRequirements.Prefer64bit } else { $false }
329+ if ($local :Prefer64bit -and (Test-Path (Join-Path $local :BinFolder " amd64" ))) {
330+ $global :_MSBuildExe = Join-Path $local :BinFolder " amd64\msbuild.exe"
331+ } else {
332+ $global :_MSBuildExe = Join-Path $local :BinFolder " msbuild.exe"
333+ }
334+
335+ return $global :_MSBuildExe
327336}
328337
329338function InitializeVisualStudioEnvironmentVariables ([string ] $vsInstallDir , [string ] $vsMajorVersion ) {
@@ -523,7 +532,7 @@ function InitializeNativeTools() {
523532 }
524533}
525534
526- function InitializeToolset ([string ] $runtimeSourceFeed , [string ] $runtimeSourceFeedKey )
535+ function InitializeToolset ([string ] $runtimeSourceFeed , [string ] $runtimeSourceFeedKey )
527536{
528537 if (Test-Path variable:global:_ToolsetBuildProj) {
529538 return $global :_ToolsetBuildProj
0 commit comments