Skip to content

legacy/1.x: Backport #909 to use global.json to pin .Net Core SDK version and update .Net SDK version to be the same as in master (2.1.801) #1054

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions PowerShellEditorServices.build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if ($PSVersionTable.PSEdition -ne "Core") {

task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestPowerShellApi {

$requiredSdkVersion = "2.0.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that 2.0 has already reached the end of its life a year ago!
https://dotnet.microsoft.com/download/dotnet-core

$requiredSdkVersion = (Get-Content (Join-Path $PSScriptRoot 'global.json') | ConvertFrom-Json).sdk.version

$dotnetPath = "$PSScriptRoot/.dotnet"
$dotnetExePath = if ($script:IsUnix) { "$dotnetPath/dotnet" } else { "$dotnetPath/dotnet.exe" }
Expand All @@ -52,10 +52,8 @@ task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestP

# 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]$version -ge [version]$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 $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.801"
}
}
2 changes: 1 addition & 1 deletion modules.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"PSScriptAnalyzer":{
"MinimumVersion":"1.18.2",
"MinimumVersion":"1.18.3",
"MaximumVersion":"1.99",
"AllowPrerelease":false
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ private Hashtable GetCustomPSSASettingsHashtable(int tabSize, bool insertSpaces)
{"PSUseConsistentIndentation", new Hashtable {
{"Enable", true},
{"IndentationSize", tabSize},
{"PipelineIndentation", PipelineIndentationStyle },
{"Kind", insertSpaces ? "space" : "tab"}
}},
{"PSUseConsistentWhitespace", new Hashtable {
Expand Down