This commit is contained in:
Vladimir Safonkin 2021-02-04 12:31:39 +03:00
parent f4159a6d20
commit 8889c6748f
1 changed files with 10 additions and 3 deletions

View File

@ -17,9 +17,16 @@ if ($version -notmatch $args[0])
if ($args[1])
{
# SDKs are listed on multiple lines with the path afterwards in square brackets
$versions = & $dotnet --list-sdks | ForEach-Object { $_.SubString(0, $_.IndexOf('[')).Trim() } | Out-String
Write-Host "Version $versions"
if ($versions -notmatch $args[1])
$versions = & $dotnet --list-sdks | ForEach-Object { $_.SubString(0, $_.IndexOf('[')).Trim() }
Write-Host "Installed versions: $versions"
$isInstalledVersion = $false
foreach ($version in $versions) {
if ($version.StartsWith($args[1])) {
$isInstalledVersion = $true
break
}
}
if (-not $isInstalledVersion)
{
Write-Host "PATH='$env:PATH'"
throw "Unexpected version"