vswhere now searches older versions of Visual Studio

Heath Stewart

One of the top requests I kept hearing for vswhere was to also search older versions of Visual Studio. You can now do that starting with the latest release.

vswhere -legacy -latest -property installationPath

Even if you don’t have Visual Studio 2017 or newer installed – which means the query API is not even registered – you can use vswhere to find the installation root directory for Visual Studio 2010 and newer.

There are some caveats:

  • You cannot also specify the -products or -requires parameters.
  • Information returned is very limited. While there are a few more properties I could scavenge, the scenario that prompted the requests was to find the location.
    "instanceId": "VisualStudio.14.0",
    "installationPath": "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\",
    "installationVersion": "14.0"

All the other vswhere parameters that control the output format and selection still work. For example, if you wanted to find the path to the latest version of Visual Studio 2010 through Visual Studio 2014.

$path = vswhere -latest -version '[10.0,15.0)' -property installationPath
if (test-path "$path\Common7\IDE\devenv.exe") {
  & $path $args

Once the new version is moderated on Chocolatey.org you can acquire it quickly using choco or PowerShell’s install-package.

For rich information about instances, I recommend you use the VSSetup PowerShell module. These support deeper analysis of instances and is designed to work only with Visual Studio 2017 and newer, or related products such as Build Tools.


Discussion is closed.

Feedback usabilla icon