Skip to content

Commit

Permalink
Update error when VS is not found, and update VS version (#1065)
Browse files Browse the repository at this point in the history
  • Loading branch information
nohwnd authored Apr 13, 2022
1 parent 5b4f128 commit 5b73c60
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions scripts/common.lib.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -154,21 +154,21 @@ function Locate-VsInstallPath($hasVsixExtension = "false") {
if ($hasVsixExtension -eq 'true') {
$requiredPackageIds += "Microsoft.VisualStudio.Component.VSSDK"
}
$version = "[16.0.0, 18.0.0)"
Write-Verbose "$vswhere -version $version -products * -requires $requiredPackageIds -property installationPath"

Write-Verbose "$vswhere -version [16.0.0, 17.1.0) -products * -requires $requiredPackageIds -property installationPath"
try {
if ($Official -or $DisallowPrereleaseMSBuild) {
$vsInstallPath = & $vswhere -version "[16.0.0, 17.1.0)" -products * -requires $requiredPackageIds -property installationPath | Select-Object -First 1
}
else {
# Allow using pre release versions of VS for dev builds
$vsInstallPath = & $vswhere -version "[16.0.0, 17.1.0)" -prerelease -products * -requires $requiredPackageIds -property installationPath | Select-Object -First 1
}
if ($Official -or $DisallowPrereleaseMSBuild) {
$vsInstallPath = & $vswhere -version $version -products * -requires $requiredPackageIds -property installationPath | Select-Object -First 1
}
catch [System.Management.Automation.MethodInvocationException] {
Write-Error "Failed to find VS installation with requirements : $requiredPackageIds."
else {
# Allow using pre release versions of VS for dev builds
$vsInstallPath = & $vswhere -version $version -prerelease -products * -requires $requiredPackageIds -property installationPath | Select-Object -First 1
}

if (-not $vsInstallPath)
{
throw "Could not find any VisualStudio with version $version and capabilities: $($requiredPackageIds -join ", ")"
}
Write-Verbose "VSInstallPath is : $vsInstallPath"
return Resolve-Path -path $vsInstallPath
}
Expand Down

0 comments on commit 5b73c60

Please # to comment.