Skip to content

Use .vsconfig File

Heath Stewart edited this page May 13, 2021 · 1 revision

You can get a list of components from a repository's .vsconfig file to pass to vswhere. You can use this approach to check if a machine has all required components without opening Visual Studio and choose to install them if needed.

PowerShell

In Microsoft-supported versions of PowerShell you can use ConvertFrom-Json to parse the .vsconfig file and pass components to vshwere:

$vsconfig = get-content .vsconfig | convertfrom-json
vswhere -latest -requires $vsconfig.components

If no search results are returned, you can invoke %ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vs_installer.exe using install or modify commands with --config .vsconfig.