Skip to content

Commit

Permalink
Add option to prefer 64bit msbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
dougbu committed Jun 16, 2021
1 parent 99023a1 commit 3c54936
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions eng/common/tools.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,12 @@ function InstallDotNetSdk([string] $dotnetRoot, [string] $version, [string] $arc
InstallDotNet -dotnetRoot $dotnetRoot -version $version -architecture $architecture -skipNonVersionedFiles $false -runtimeSourceFeed $runtimeSourceFeed -runtimeSourceFeedKey $runtimeSourceFeedKey
}

function InstallDotNet([string] $dotnetRoot,
[string] $version,
[string] $architecture = "",
[string] $runtime = "",
[bool] $skipNonVersionedFiles = $false,
[string] $runtimeSourceFeed = "",
function InstallDotNet([string] $dotnetRoot,
[string] $version,
[string] $architecture = "",
[string] $runtime = "",
[bool] $skipNonVersionedFiles = $false,
[string] $runtimeSourceFeed = "",
[string] $runtimeSourceFeedKey = "") {

$installScript = GetDotNetInstallScript $dotnetRoot
Expand Down Expand Up @@ -323,7 +323,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 @@ -523,7 +532,7 @@ function InitializeNativeTools() {
}
}

function InitializeToolset([string] $runtimeSourceFeed, [string] $runtimeSourceFeedKey)
function InitializeToolset([string] $runtimeSourceFeed, [string] $runtimeSourceFeedKey)
{
if (Test-Path variable:global:_ToolsetBuildProj) {
return $global:_ToolsetBuildProj
Expand Down

0 comments on commit 3c54936

Please sign in to comment.