fix: actually support vswhere not finding something (#4682)

By default vswhere returns a non-zero error code making our error handling fail
This commit is contained in:
Mitch Capper (they, them)
2024-01-17 01:07:32 -08:00
committed by GitHub
parent 14dba5457c
commit fb24fd22e5
+4
View File
@@ -183,13 +183,17 @@ function VSX
$versionSearchStr = "[$VS_VER.0," + ($VS_VER+1) + ".0)"
$ErrorActionPreference="SilentlyContinue"
$VSInstallPath = & $VSWherePath -version $versionSearchStr -property installationPath $VS_PRE
$ErrorActionPreference="Stop"
Write-Diagnostic "$($VS_OFFICIAL_VER)InstallPath: $VSInstallPath"
if( -not $VSInstallPath -or -not (Test-Path $VSInstallPath))
{
$ErrorActionPreference="SilentlyContinue"
$VSInstallPath = & $VSwherePath -version $versionSearchStr -property installationPath $VS_PRE -products 'Microsoft.VisualStudio.Product.BuildTools'
$ErrorActionPreference="Stop"
Write-Diagnostic "BuildTools $($VS_OFFICIAL_VER)InstallPath: $VSInstallPath"
if( -not $VSInstallPath -or -not (Test-Path $VSInstallPath))