VsWhere and Visual Studio 2017

Filed under: DevOps

Visual Studio has made some major changes in its latest form. Visual Studio 2017 relies less on the windows registry, has a different folder structure, has newer versions of msbuild and vstest and comes with a nifty tool called vswhere.exe as of update 1.

VsWhere can be found on github, can be installed via chocolatey, and can be handy for those in DevOps. VsWhere will locate the various versions of Visual Studio for 15+, find MsBuild and find Visual Studio Test Console.

Here is a quick sample of how you can call VsWhere and get the results back as JSON.

 $vsWhere = "${Env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" 

if(Test-Path $vsWhere) {
  $versionJson = & $vsWhere -version "[15.0,16.0)" -format json
  $versionJson | Out-File "$Env:USERPROFILE\Desktop\vscache.json" 
  $versions = $versionJson | ConvertFrom-Json
  foreach($version in $versions) {
      Write-Host ($version.installationPath)
Nerdy Mishka