Skip to content

Commit

Permalink
install dotnet SDK on windows before running the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jtattermusch committed Mar 11, 2019
1 parent 0efbd9a commit 5e3e9fb
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
21 changes: 21 additions & 0 deletions csharp/install_dotnet_sdk.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env powershell
# Install dotnet SDK based on the SDK version from global.json

Set-StrictMode -Version 2
$ErrorActionPreference = 'Stop'

# 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'
$GlobalJsonPath = Join-Path $PSScriptRoot '..' | Join-Path -ChildPath 'global.json'

# Resolve SDK version from global.json file
$GlobalJson = Get-Content -Raw $GlobalJsonPath | ConvertFrom-Json
$SDKVersion = $GlobalJson.sdk.version

# Download install script
Write-Host "Downloading install script: $InstallScriptUrl => $InstallScriptPath"
Invoke-WebRequest -Uri $InstallScriptUrl -OutFile $InstallScriptPath
&$InstallScriptPath -Version $SDKVersion
5 changes: 5 additions & 0 deletions kokoro/release/csharp/windows/build_nuget.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@
cd /d %~dp0\..\..\..\..

cd csharp

@rem Install dotnet SDK
powershell -File install_dotnet_sdk.ps1
set PATH=%LOCALAPPDATA%\Microsoft\dotnet;%PATH%

call build_packages.bat

0 comments on commit 5e3e9fb

Please sign in to comment.