blob: 9e300eda067b2be0db8a2c4079e689166aa6c79b [file] [log] [blame]
Sydney Acksman15fab912019-03-11 15:03:58 -05001#!/usr/bin/env powershell
2# Install dotnet SDK based on the SDK version from global.json
3
4Set-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
19Write-Host "Downloading install script: $InstallScriptUrl => $InstallScriptPath"
20Invoke-WebRequest -Uri $InstallScriptUrl -OutFile $InstallScriptPath
21&$InstallScriptPath -Version $SDKVersion
Jan Tattermusch0c8acb62019-11-14 18:39:31 +010022
23# Also install dotnet SDK LTS which is required to run some of the tests
24&$InstallScriptPath -Version 2.1.802