Exit early if no VS is found

This commit is contained in:
Alexander Karatarakis 2017-11-30 16:43:41 -08:00
parent 0aa1bfe293
commit fdf7c65aa4
2 changed files with 6 additions and 1 deletions

View File

@ -46,7 +46,7 @@ try
& $msbuildExe "/p:VCPKG_VERSION=-$gitHash" "/p:DISABLE_METRICS=$disableMetrics" /p:Configuration=Release /p:Platform=x86 /p:PlatformToolset=$platformToolset /p:TargetPlatformVersion=$windowsSDK /m dirs.proj
if ($LASTEXITCODE -ne 0)
{
Write-Error "Building vcpkg.exe failed. Please ensure you have installed the Desktop C++ workload and the Windows SDK for Desktop C++."
Write-Error "Building vcpkg.exe failed. Please ensure you have installed Visual Studio with the Desktop C++ workload and the Windows SDK for Desktop C++."
return
}

View File

@ -8,6 +8,11 @@ $withVSPath = $withVSPath -replace "\\$" # Remove potential trailing backslash
$scriptsDir = split-path -parent $MyInvocation.MyCommand.Definition
$VisualStudioInstallationInstances = & $scriptsDir\findVisualStudioInstallationInstances.ps1
if ($VisualStudioInstallationInstances -eq $null)
{
throw "Could not find Visual Studio. VS2015 or VS2017 (with C++) needs to be installed."
}
Write-Verbose "VS Candidates:`n`r$([system.String]::Join([Environment]::NewLine, $VisualStudioInstallationInstances))"
foreach ($instanceCandidateWithEOL in $VisualStudioInstallationInstances)
{