One of the big changes found in Visual Studio 2017 is a complete rewrite of its installation program. Previous builds of Visual Studio were fairly monolithic, requiring significant time and disk space in order to complete their installation. These changes to the installation process have been welcomed, however they require a change in how Visual Studio and its components are detected.
As Microsoft's Heath Stewart observes, this means previously used methods, such as querying the registry for information about installed copies of Visual Studio, are no longer the best approach (if they work at all). Instead, the recommended approach is to use the Visual Studio setup query API. This API is designed to work VS2017 (or newer) and can provide information about the edition of VS2017 installed (Community, Professional, or Enterprise) as well as details about various components. Getting information about the current development environment is of great assistance to build systems, which can now more easily determine if the components they need for automation are present.
To help illustrate usage of this API as well as make it more accessible, a couple of different methods are available to developers and devops personnel. Firstly, a PowerShell module exists which provides the ability to search for installed editions of VS2017 and check for the presence of installed components.
For those looking for a standalone executable, Stewart has introduced vswhere, a standalone executable which provides a subset of the capabilities found in the PowerShell module. This is available on GitHub, and is easily compiled into a usable format. Finally, for those looking for more details on the query API itself, there is an additional repository available which provides C#, C++, and Visual Basic based examples.