vswhere now supports -requiresAny to find instances with one or more components installed

The latest release of vswhere.exe supports a new switch parameter, -requiresAny (case-insensitive). This switch changes the behavior of -requires to return any instances that have one or more workloads or components installed.

As Visual Studio continues to add value with more features (including lots of partner content) targeting a wider variety of workloads, we made significant changes to better modularize the install. The refactoring effort was huge and some scenarios may not have been anticipated. As one example, vstest.console.exe is in a single package but we don’t recommend using package IDs in vswhere.exe because we may (and very often have) changed package IDs as refactoring continues. But in this example, the package in which vstest.console.exe ships can be found in two distinct workloads. Depending on your build environment, invoking vswhere.exe twice might been problematic, so -requiresAny can be useful like in the following example:

vswhere.exe -latest -requires Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.Workload.Web -requiresAny -property installationPath

See Find VSTest or related content in our wiki for more examples.