提交 442041cf 编写于 作者: J Jared Parsons

Download the CLI for CI / xcopy scenarios

Changes our core build scripts to download the CLI / SDK as needed.
上级 f9ccbbdd
......@@ -107,7 +107,6 @@ function Exec-Script([string]$script, [string]$scriptArgs = "") {
Exec-Command "powershell" "-noprofile -executionPolicy RemoteSigned -file `"$script`" $scriptArgs"
}
# Ensure that NuGet is installed and return the path to the
# executable to use.
function Ensure-NuGet() {
......@@ -134,6 +133,45 @@ function Ensure-NuGet() {
return $destFile
}
# Checks to see if a particular version of the SDK is available on %PATH%. This is
# how MSBuild locates the SDK.
function Test-SdkInPath([string]$version) {
foreach ($part in ${env:PATH}.Split(';')) {
$dotnetExe = Join-Path $part "dotnet.exe"
if (Test-Path $dotnetExe) {
$sdkPath = Join-Path $part "sdk"
$sdkPath = Join-Path $sdkPath $version
return Test-Path $sdkPath
}
}
return $false
}
# Ensure the proper SDK in installed in our %PATH%. This is how MSBuild locates the
# SDK.
function Ensure-SdkInPath() {
$sdkVersion = "2.0.0-preview3-006923"
if (Test-SdkInPath $sdkVersion) {
return
}
$toolsDir = Join-Path $binariesDir "Tools"
$cliDir = Join-Path $toolsDir "dotnet"
$dotnetExe = Join-Path
if (-not (Test-Path $dotnetExe)) {
Write-Host "Downloading CLI $sdkVersion"
Create-Directory $cliDir
Create-Directory $toolsDir
$destFile = Join-Path $toolsDir "dotnet-install.ps1"
$webClient = New-Object -TypeName "System.Net.WebClient"
$webClient.DownloadFile("https://dot.net/v1/dotnet-install.ps1", $destFile)
Exec-Block { & $destFile -Version $sdkVersion -InstallDir $cliDir }
}
${env:PATH} = "$cliDir;${env:PATH}"
}
# Ensure a basic tool used for building our Repo is installed and
# return the path to it.
function Ensure-BasicTool([string]$name, [string]$version = "") {
......@@ -165,6 +203,7 @@ function Ensure-MSBuild([switch]$xcopy = $false) {
}
$p = Join-Path $msbuildDir "msbuild.exe"
Ensure-SdkInPath
return $p
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册