-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_dotnet_sdk.ps1
30 lines (24 loc) · 1.05 KB
/
install_dotnet_sdk.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env powershell
# Install dotnet SDK needed to build C# projects on Windows
Set-StrictMode -Version 2
$ErrorActionPreference = 'Stop'
# Disable progress bar to avoid getting the
# '"Access is denied" 0x5 occurred while reading the console output buffer'
# error when running on kokoro (i.e. in non-interactive mode)
$global:ProgressPreference = 'SilentlyContinue'
trap {
$ErrorActionPreference = "Continue"
Write-Error $_
exit 1
}
# avoid "Unknown error on a send" in Invoke-WebRequest
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
$InstallScriptUrl = 'https://dot.net/v1/dotnet-install.ps1'
$InstallScriptPath = Join-Path "$env:TEMP" 'dotnet-install.ps1'
# Download install script
Write-Host "Downloading install script: $InstallScriptUrl => $InstallScriptPath"
Invoke-WebRequest -Uri $InstallScriptUrl -OutFile $InstallScriptPath
# Installed versions should be kept in sync with
# templates/tools/dockerfile/csharp_dotnetcli_deps.include
&$InstallScriptPath -Version 3.1.415
&$InstallScriptPath -Version 6.0.100