Skip to content

Commit

Permalink
[release/5.0] Add option to prefer 64bit msbuild (#7558)
Browse files Browse the repository at this point in the history
- cherry-pick of a5dbede / #7531
  • Loading branch information
dougbu authored Jun 24, 2021
1 parent a5dbede commit 0214a32
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions eng/common/tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,16 @@ function InitializeVisualStudioMSBuild([bool]$install, [object]$vsRequirements =
}

$msbuildVersionDir = if ([int]$vsMajorVersion -lt 16) { "$vsMajorVersion.0" } else { "Current" }
return $global:_MSBuildExe = Join-Path $vsInstallDir "MSBuild\$msbuildVersionDir\Bin\msbuild.exe"

$local:BinFolder = Join-Path $vsInstallDir "MSBuild\$msbuildVersionDir\Bin"
$local:Prefer64bit = if ($vsRequirements.Prefer64bit) { $vsRequirements.Prefer64bit } else { $false }
if ($local:Prefer64bit -and (Test-Path(Join-Path $local:BinFolder "amd64"))) {
$global:_MSBuildExe = Join-Path $local:BinFolder "amd64\msbuild.exe"
} else {
$global:_MSBuildExe = Join-Path $local:BinFolder "msbuild.exe"
}

return $global:_MSBuildExe
}

function InitializeVisualStudioEnvironmentVariables([string] $vsInstallDir, [string] $vsMajorVersion) {
Expand Down Expand Up @@ -527,7 +536,7 @@ function GetDefaultMSBuildEngine() {

function GetNuGetPackageCachePath() {
if ($env:NUGET_PACKAGES -eq $null) {
# Use local cache on CI to ensure deterministic build.
# Use local cache on CI to ensure deterministic build.
# Avoid using the http cache as workaround for https://github.com/NuGet/Home/issues/3116
# use global cache in dev builds to avoid cost of downloading packages.
# For directory normalization, see also: https://github.com/NuGet/Home/issues/7968
Expand Down

0 comments on commit 0214a32

Please sign in to comment.