This commit is contained in:
Vladimir Safonkin 2021-02-04 12:18:06 +03:00
parent 44b8627225
commit 7164f75e01

View File

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