With last week's launch of Visual Studio 2017, one of the much discussed topics was its new setup experience and new side-by-side capability.
While this is awesome, for extension developers, troubleshooters and DevOps'ers, it can be something of a pain, finding out just where a given VS install is on disk.
Heath Stewart, who blogs about setup and install, Setup & Install by Heath Stewart, felt that pain.
And he did something about it!
Visual Studio Locator
Over the years Visual Studio could be discovered using registry keys, but with recent changes to the deployment and extensibility models a new method is needed to discover possibly more than once installed instance. These changes facilitate a smaller, faster default install complimented by on-demand install of other workloads and components.
vswhere is designed to be a redistributable, single-file executable that can be used in build or deployment scripts to find where Visual Studio - or other products in the Visual Studio family - is located. For example, if you know the relative path to MSBuild, you can find the root of the Visual Studio install and combine the paths to find what you need.
You can emit different formats for information based on what your scripts can consume, including plain text, JSON, and XML. Pull requests may be accepted for other common formats as well.
If you wanted to find MSBuild - now installed under the Visual Studio 2017 and newer installation root - you could script a command like the following to find the latest version installed.@echo off
for /f "usebackq tokens=1* delims=: " %%I in (`vswhere -latest -requires Microsoft.Component.MSBuild`) do (
if /I "%%I"=="installationPath" set InstallDir=%%j
if exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" (
You can find more examples in our wiki. ...
As you would expect, he continues to improve and blog about VSWhere, as well as the new Setup API...
- vswhere now searches older versions of Visual Studio
- Fast acquisition of vswhere
- vswhere Available
- Visual Studio Setup PowerShell Module Available
- Documentation available for the Setup Configuration API
- Changes to Visual Studio “15” Setup