Acquire dotnet-install.ps1 from dot.net (#1849)

This commit is contained in:
James Newton-King
2018-09-22 09:49:54 -07:00
committed by GitHub
parent 306e695f69
commit 74add1336a
2 changed files with 15 additions and 505 deletions
+15 -2
View File
@@ -70,6 +70,8 @@ task Build -depends Clean {
Write-Host -ForegroundColor Green "Found $($script:enabledBuilds.Length) enabled builds"
mkdir "$buildDir\Temp" -Force
EnsureDotNetCli
EnsureNuGetExists
EnsureNuGetPackage "vswhere" $vswherePath $vswhereVersion
EnsureNuGetPackage "NUnit.ConsoleRunner" $nunitConsolePath $nunitConsoleVersion
@@ -161,6 +163,19 @@ function NetCliBuild()
exec { & $script:msBuildPath "/t:build" "/v:$msbuildVerbosity" $projectPath "/p:Configuration=Release" "/p:LibraryFrameworks=`"$libraryFrameworks`"" "/p:TestFrameworks=`"$testFrameworks`"" "/p:AssemblyOriginatorKeyFile=$signKeyPath" "/p:SignAssembly=$signAssemblies" "/p:TreatWarningsAsErrors=$treatWarningsAsErrors" "/p:AdditionalConstants=$additionalConstants" "/p:GeneratePackageOnBuild=$buildNuGet" "/p:ContinuousIntegrationBuild=true" "/p:PackageId=$packageId" "/p:VersionPrefix=$majorWithReleaseVersion" "/p:VersionSuffix=$nugetPrerelease" "/p:AssemblyVersion=$assemblyVersion" "/p:FileVersion=$version" "/m" }
}
function EnsureDotnetCli()
{
Write-Host "Downloading dotnet-install.ps1"
# https://stackoverflow.com/questions/36265534/invoke-webrequest-ssl-fails
[Net.ServicePointManager]::SecurityProtocol = 'TLS12'
Invoke-WebRequest `
-Uri "https://dot.net/v1/dotnet-install.ps1" `
-OutFile "$buildDir\Temp\dotnet-install.ps1"
exec { & $buildDir\Temp\dotnet-install.ps1 -Channel $netCliChannel -Version $netCliVersion | Out-Default }
}
function EnsureNuGetExists()
{
if (!(Test-Path $nugetPath))
@@ -194,8 +209,6 @@ function NetCliTests($build)
$location = "$sourceDir\Newtonsoft.Json.Tests"
$testDir = if ($build.TestFramework -ne $null) { $build.TestFramework } else { $build.Framework }
exec { .\Tools\Dotnet\dotnet-install.ps1 -Channel $netCliChannel -Version $netCliVersion | Out-Default }
try
{
Set-Location $location