Skip to content

Commit b3d23cf

Browse files
committed
Improve error message when hunting for cli version
Use output of dotnet --version if there are problems with --list-sdks
1 parent 4909995 commit b3d23cf

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

build.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ function Get-InstalledCLIVersion {
423423
try {
424424
# earlier versions of dotnet do not support --list-sdks, so we'll check the output
425425
# and use dotnet --version as a fallback
426-
427426
$sdkList = & $script:dotnetExe --list-sdks 2>&1
428427
$sdkList = "Unknown option"
429428
if ( $sdkList -match "Unknown option" ) {
@@ -434,7 +433,8 @@ function Get-InstalledCLIVersion {
434433
}
435434
}
436435
catch {
437-
$installedVersions = @()
436+
Write-Verbose -Verbose "$_"
437+
$installedVersions = & $script:dotnetExe --version
438438
}
439439
return (ConvertTo-PortableVersion $installedVersions)
440440
}

0 commit comments

Comments
 (0)