Skip to content

Installing

Heath Stewart edited this page Oct 17, 2022 · 4 revisions

Starting with Visual Studio 15.2 (26418.1 Preview) vswhere.exe is installed in %ProgramFiles(x86)%\Microsoft Visual Studio\Installer (use %ProgramFiles% in a 32-bit program prior to Windows 10). This is a fixed location that will be maintained.

If you cannot rely on Visual Studio being installed or want to support older versions before vswhere.exe was installed by default, there are a number of options currently available to download or install vswhere.exe.

  • You can download and redistribute it from our releases page.
  • You can download it as a NuGet package.
  • You can install it using winget version 1.3 or newer:
    winget install Microsoft.VisualStudio.Locator
  • You can install it using scoop:
    scoop install vswhere
  • You can install it using Chocolatey.

NuGet

Build systems or code projects that want to redistribute vswhere.exe might find the NuGet package a good option. NuGet will download and extract it based either on your -OutputDirectory parameter value or into a solution's packages directory. For ease of use, installing the package into one or more projects in a solution will automatically include vswhere.props which defines a VSWhereDir MSBuild property you can use in your project however you like.

You can also use vswhere.exe globally by including a package reference to it in $(SolutionDir)\.nuget\packages.config and adding some scripts to your repo to locate and run vswhere.exe as shown in the vs-setup-samples repository.

Chocolatey

The very same NuGet package can be installed with Chocolatey. If you have Chocolatey installed, you can install the package for all users - which will automatically add the package to your PATH - like so.

choco install vswhere

You can also use the PackageManagement module for PowerShell that is installed by default with WMF 5.0, or available as a separate install.

From an elevated command prompt:

# Only necessary once if you have not yet installed the Chocolatey package provider.
install-packageprovider Chocolatey -force

install-package vswhere -provider Chocolatey -force

Warning: there is a bug in the Chocolatey provider that installs the stub vswhere.bat into the wrong directory that is not in the PATH. You can add $env:SystemDrive\Chocolatey\bin to your PATH or use the choco CLI until it is fixed and the Chocolatey provider updated.

You can upgrade the package using choco upgrade vswhere, or run install-package again in PowerShell to install the latest version.