-
Notifications
You must be signed in to change notification settings - Fork 103
Description
We have had a number of requests for vswhere to return paths to specific tools - most often MSBuild.exe. Because vswhere is a general tool that provides information not only for Visual Studio but Build Tools and other SKUs we install, and because any of those products have unknown numbers of executables or other useful files, locating specific components is not a capability we can accommodate.
At the same time, we realize that making every caller script algorithms like those in our examples puts a burden on all developers when a consolidated algorithm would be easier to use.
We propose a new switch -find (like the UNIX find program) that takes a glob pattern as an argument to find executables under the install root. Supported patterns include,
| Token | Description |
|---|---|
| * | Find 0 or more of any character. |
| ? | Find exactly one of any character. |
| ** | In place of a directory token, recursively search for the remaining path. |
This is similar to find and existing DOS-based globbing support in Windows, with the addition of the globstar (**) that is popular in minimatch patterns.
Used in conjunction with -latest, for example, one could easily find MSBuild with whatever directory name they used (it changed between Visual Studio 2017 and 2019):
$path = vswhere -latest -requires Microsoft.Component.MSBuild -find "MSBuild\**\Bin\MSBuild.exe"Multiple results are returned in the selected format (-format value is the default, like with -property) if the pattern matches multiple results, so the more specific you can be the better. A new switch -sort will also be added to sort instances before returning results - an alternative to -latest if you want to find all candidates from newest instance to oldest.
Cc: @refack @KindDragon @3F @uli-weltersbach @IanKemp @zivkan