Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion build-tools/scripts/vswhere.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
@echo off
CALL "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath
SET result = ""
FOR /F "tokens=1 delims=" %%F IN ('"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath') DO SET result=%%F
if "%result%" == "" (
FOR /F "tokens=1 delims=" %%F IN ('"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -prerelease -latest -property installationPath') DO SET result=%%F
)
echo %result%
4 changes: 4 additions & 0 deletions tools/vswhere/MSBuildLocator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ public static VisualStudioInstance QueryLatest ()
if (!File.Exists (vswhere))
throw new FileNotFoundException ("Cannot find vswhere.exe!", vswhere);
instance.VisualStudioRootPath = Exec (vswhere, "-latest -products * -requires Microsoft.Component.MSBuild -property installationPath");
if (!Directory.Exists (instance.VisualStudioRootPath)) {
// try -prerelease
instance.VisualStudioRootPath = Exec (vswhere, "-prerelease -latest -products * -requires Microsoft.Component.MSBuild -property installationPath");
}
if (!Directory.Exists (instance.VisualStudioRootPath)) {
throw new DirectoryNotFoundException ($"vswhere.exe result returned a directory that did not exist: {instance.VisualStudioRootPath}");
}
Expand Down