Skip to content

Commit e3a32df

Browse files
bergmeisterTylerLeonhardt
authored andcommitted
Use global.json to pin .Net Core SDK version and update it from 2.1.402 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
1 parent 46eb697 commit e3a32df

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

PowerShellEditorServices.build.ps1

+3-6
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,12 @@ $script:IsCIBuild = $env:APPVEYOR -ne $null
2222
$script:IsUnix = $PSVersionTable.PSEdition -and $PSVersionTable.PSEdition -eq "Core" -and !$IsWindows
2323
$script:TargetPlatform = "netstandard2.0"
2424
$script:TargetFrameworksParam = "/p:TargetFrameworks=`"$script:TargetPlatform`""
25-
$script:RequiredSdkVersion = "2.1.402"
25+
$script:RequiredSdkVersion = (Get-Content (Join-Path $PSScriptRoot 'global.json') | ConvertFrom-Json).sdk.version
2626
$script:NugetApiUriBase = 'https://www.nuget.org/api/v2/package'
2727
$script:ModuleBinPath = "$PSScriptRoot/module/PowerShellEditorServices/bin/"
2828
$script:VSCodeModuleBinPath = "$PSScriptRoot/module/PowerShellEditorServices.VSCode/bin/"
2929
$script:WindowsPowerShellFrameworkTarget = 'net461'
3030
$script:NetFrameworkPlatformId = 'win'
31-
$script:NetCoreTestingFrameworkVersion = '2.1.4'
3231
$script:BuildInfoPath = [System.IO.Path]::Combine($PSScriptRoot, "src", "PowerShellEditorServices.Host", "BuildInfo", "BuildInfo.cs")
3332

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

199198
# Make sure the dotnet we found is the right version
200199
if ($dotnetExePath) {
201-
# dotnet --version can return a semver that System.Version can't handle
202-
# e.g.: 2.1.300-preview-01. The replace operator is used to remove any build suffix.
203-
$version = (& $dotnetExePath --version) -replace '[+-].*$',''
204-
if ($version -and [version]$version -ge [version]$script:RequiredSdkVersion) {
200+
# dotnet --version can write to stderr, which causes builds to abort, therefore use --list-sdks instead.
201+
if ((& $dotnetExePath --list-sdks | ForEach-Object { $_.Split()[0] } ) -contains $script:RequiredSdkVersion) {
205202
$script:dotnetExe = $dotnetExePath
206203
}
207204
else {

global.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"sdk": {
3+
"version": "2.1.602"
4+
}
5+
}

0 commit comments

Comments
 (0)