1 #!/usr/bin/env powershell
2 # Install dotnet SDK needed to build C# projects on Windows
4 Set-StrictMode -Version 2
5 $ErrorActionPreference = 'Stop'
7 # avoid "Unknown error on a send" in Invoke-WebRequest
8 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
10 $InstallScriptUrl = 'https://dot.net/v1/dotnet-install.ps1'
11 $InstallScriptPath = Join-Path "$env:TEMP" 'dotnet-install.ps1'
13 # Download install script
14 Write-Host "Downloading install script: $InstallScriptUrl => $InstallScriptPath"
15 Invoke-WebRequest -Uri $InstallScriptUrl -OutFile $InstallScriptPath
16 &$InstallScriptPath -Version 2.1.504