Skip to content

Commit

Permalink
Appveyor (dotnet#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
DedSec256 authored and auduchinok committed Jul 27, 2020
1 parent ee8a741 commit 026585e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
6 changes: 6 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: 1.0.{build}
install:
- ps: fcs/installSDK.ps1
build_script:
- cmd: fcs/build.cmd
test: off
27 changes: 27 additions & 0 deletions fcs/installSDK.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Ensures that .net core is up to date.
# first get the required version from global.json
$json = ConvertFrom-Json (Get-Content "$PSScriptRoot/global.json" -Raw)
$required_version = $json.sdk.version

# Running dotnet --version stupidly fails if the required SDK version is higher
# than the currently installed version. So move global.json out the way
# and then put it back again
Rename-Item "$PSScriptRoot/global.json" "$PSScriptRoot/global.json.bak"
$current_version = (dotnet --version)
Rename-Item "$PSScriptRoot/global.json.bak" "$PSScriptRoot/global.json"
Write-Host "Required .NET version: $required_version, Installed: $current_version"

if ($current_version -lt $required_version) {
# Current installed version is too low.
# Install new version as a local only dependency.
$urlCurrent = "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/$required_version/dotnet-sdk-$required_version-win-x64.zip"
Write-Host "Installing .NET Core $required_version from $urlCurrent"
$env:DOTNET_INSTALL_DIR = "$PSScriptRoot/.dotnetsdk"
New-Item -Type Directory $env:DOTNET_INSTALL_DIR -Force | Out-Null
(New-Object System.Net.WebClient).DownloadFile($urlCurrent, "dotnet.zip")
Write-Host "Unzipping to $env:DOTNET_INSTALL_DIR"
Add-Type -AssemblyName System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::ExtractToDirectory("dotnet.zip", $env:DOTNET_INSTALL_DIR)

Write-Host "Using .NET SDK from $env:DOTNET_INSTALL_DIR"
$env:PATH = "$env:DOTNET_INSTALL_DIR;$env:PATH"
}

0 comments on commit 026585e

Please sign in to comment.