$ show microsoft/vswhere
vswhere is a command-line utility developed by Microsoft to locate installed instances of Visual Studio and related products (Build Tools, etc.). It queries the Visual Studio Setup Configuration API (ISetupConfiguration) and the Windows Registry to discover installation paths, versions, and workloads. The tool supports filtering by version range, product ID, workload requirements, and legacy installations. Output can be formatted as text, JSON, XML, or raw values, making it suitable for build scripts and deployment automation. The architecture consists of a core static library (vswhere.lib) containing the logic for parsing, querying, and formatting, linked against a minimal executable entry point (vswhere.exe). It relies on COM interfaces for setup configuration and standard C++17 libraries for string and filesystem operations.
The LLM identified 3 files worth highlighting for reuse:
Implements the core filtering logic for Visual Studio instances. It handles complex criteria including version ranges (e.g., [15.0,16.0)), product IDs, workload requirements (with wildcard support), and legacy instance merging. The code demonstrates robust error handling and efficient iteration over COM interfaces, making it a reusable pattern for filtering complex object graphs based on dynamic criteria.
Provides a custom glob pattern matching implementation for Windows file paths. It converts glob patterns (e.g., **\msbuild.exe) into regular expressions, handling edge cases like directory separators, wildcards, and path normalization. This component is self-contained and demonstrates non-obvious skill in parsing and validating file search patterns, suitable for extraction into a general-purpose file search utility.
Implements the Strategy pattern for output serialization. It defines a common interface for formatting instances into text, JSON, XML, or value formats. The base class handles property retrieval and common logic, while derived classes handle specific serialization details. This separation of concerns allows for easy extension to new formats and demonstrates clean architectural design for data presentation.