Minor fixes

This commit is contained in:
Vladimir Safonkin 2021-02-04 13:26:18 +03:00
parent 5d1a72cb19
commit a841c568fd
1 changed files with 5 additions and 3 deletions

View File

@ -8,7 +8,7 @@ Write-Host "Found '$dotnet'"
$version = & $dotnet --version | Out-String | ForEach-Object { $_.Trim() } $version = & $dotnet --version | Out-String | ForEach-Object { $_.Trim() }
Write-Host "Version $version" Write-Host "Version $version"
if ($version -notmatch $args[0]) if (-not ($version.StartsWith($args[0])))
{ {
Write-Host "PATH='$env:PATH'" Write-Host "PATH='$env:PATH'"
throw "Unexpected version" throw "Unexpected version"
@ -20,8 +20,10 @@ if ($args[1])
$versions = & $dotnet --list-sdks | ForEach-Object { $_.SubString(0, $_.IndexOf('[')).Trim() } $versions = & $dotnet --list-sdks | ForEach-Object { $_.SubString(0, $_.IndexOf('[')).Trim() }
Write-Host "Installed versions: $versions" Write-Host "Installed versions: $versions"
$isInstalledVersion = $false $isInstalledVersion = $false
foreach ($version in $versions) { foreach ($version in $versions)
if ($version.StartsWith($args[1].ToString())) { {
if ($version.StartsWith($args[1].ToString()))
{
$isInstalledVersion = $true $isInstalledVersion = $true
break break
} }