Skip to content

Commit 2523e71

Browse files
authored
Fix issue using pre-release version of NET Core SDK (#643)
1 parent 1e3234c commit 2523e71

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

PowerShellEditorServices.build.ps1

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,17 @@ task SetupDotNet -Before Clean, Build, TestHost, TestServer, TestProtocol, TestP
3737
}
3838

3939
# Make sure the dotnet we found is the right version
40-
if ($dotnetExePath -and [version](& $dotnetExePath --version) -ge [version]$requiredSdkVersion) {
41-
$script:dotnetExe = $dotnetExePath
40+
if ($dotnetExePath) {
41+
# dotnet --version can return a semver that System.Version can't handle
42+
# e.g.: 2.1.300-preview-01. The replace operator is used to remove any build suffix.
43+
$version = (& $dotnetExePath --version) -replace '[+-].*$',''
44+
if ([version]$version -ge [version]$requiredSdkVersion) {
45+
$script:dotnetExe = $dotnetExePath
46+
}
47+
else {
48+
# Clear the path so that we invoke installation
49+
$script:dotnetExe = $null
50+
}
4251
}
4352
else {
4453
# Clear the path so that we invoke installation

0 commit comments

Comments
 (0)