Sydney Acksman | 15fab91 | 2019-03-11 15:03:58 -0500 | [diff] [blame] | 1 | #!/usr/bin/env powershell |
| 2 | # Install dotnet SDK based on the SDK version from global.json |
| 3 | |
| 4 | Set-StrictMode -Version 2 |
| 5 | $ErrorActionPreference = 'Stop' |
| 6 | |
| 7 | # avoid "Unknown error on a send" in Invoke-WebRequest |
| 8 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 |
| 9 | |
| 10 | $InstallScriptUrl = 'https://dot.net/v1/dotnet-install.ps1' |
| 11 | $InstallScriptPath = Join-Path "$env:TEMP" 'dotnet-install.ps1' |
| 12 | $GlobalJsonPath = Join-Path $PSScriptRoot '..' | Join-Path -ChildPath 'global.json' |
| 13 | |
| 14 | # Resolve SDK version from global.json file |
| 15 | $GlobalJson = Get-Content -Raw $GlobalJsonPath | ConvertFrom-Json |
| 16 | $SDKVersion = $GlobalJson.sdk.version |
| 17 | |
| 18 | # Download install script |
| 19 | Write-Host "Downloading install script: $InstallScriptUrl => $InstallScriptPath" |
| 20 | Invoke-WebRequest -Uri $InstallScriptUrl -OutFile $InstallScriptPath |
| 21 | &$InstallScriptPath -Version $SDKVersion |
Jan Tattermusch | 0c8acb6 | 2019-11-14 18:39:31 +0100 | [diff] [blame^] | 22 | |
| 23 | # Also install dotnet SDK LTS which is required to run some of the tests |
| 24 | &$InstallScriptPath -Version 2.1.802 |