Skip to content

Commit

Permalink
Use global.json to pin .Net Core SDK version and update it from 2.1.4…
Browse files Browse the repository at this point in the history
…02 to 2.1.602 (#909)

* Update .Net Core SDK, use global.json and remove unused NetCoreTestingFrameworkVersion variable

* re-trigger CI

* fix call to dotnet

* fix installation

* fix check for dotnet

* minimise diff

* re-trigger ci

* re-trigger ci

* re-trigger ci
  • Loading branch information
bergmeister authored and TylerLeonhardt committed Apr 8, 2019
1 parent 46eb697 commit e3a32df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
9 changes: 3 additions & 6 deletions PowerShellEditorServices.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ $script:IsCIBuild = $env:APPVEYOR -ne $null
$script:IsUnix = $PSVersionTable.PSEdition -and $PSVersionTable.PSEdition -eq "Core" -and !$IsWindows
$script:TargetPlatform = "netstandard2.0"
$script:TargetFrameworksParam = "/p:TargetFrameworks=`"$script:TargetPlatform`""
$script:RequiredSdkVersion = "2.1.402"
$script:RequiredSdkVersion = (Get-Content (Join-Path $PSScriptRoot 'global.json') | ConvertFrom-Json).sdk.version
$script:NugetApiUriBase = 'https://www.nuget.org/api/v2/package'
$script:ModuleBinPath = "$PSScriptRoot/module/PowerShellEditorServices/bin/"
$script:VSCodeModuleBinPath = "$PSScriptRoot/module/PowerShellEditorServices.VSCode/bin/"
$script:WindowsPowerShellFrameworkTarget = 'net461'
$script:NetFrameworkPlatformId = 'win'
$script:NetCoreTestingFrameworkVersion = '2.1.4'
$script:BuildInfoPath = [System.IO.Path]::Combine($PSScriptRoot, "src", "PowerShellEditorServices.Host", "BuildInfo", "BuildInfo.cs")

$script:PSCoreModulePath = $null
Expand Down Expand Up @@ -198,10 +197,8 @@ task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, Packa

# Make sure the dotnet we found is the right version
if ($dotnetExePath) {
# dotnet --version can return a semver that System.Version can't handle
# e.g.: 2.1.300-preview-01. The replace operator is used to remove any build suffix.
$version = (& $dotnetExePath --version) -replace '[+-].*$',''
if ($version -and [version]$version -ge [version]$script:RequiredSdkVersion) {
# dotnet --version can write to stderr, which causes builds to abort, therefore use --list-sdks instead.
if ((& $dotnetExePath --list-sdks | ForEach-Object { $_.Split()[0] } ) -contains $script:RequiredSdkVersion) {
$script:dotnetExe = $dotnetExePath
}
else {
Expand Down
5 changes: 5 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "2.1.602"
}
}

0 comments on commit e3a32df

Please sign in to comment.