-
Notifications
You must be signed in to change notification settings - Fork 45
Selecting an Instance
A product instance contains a lot of information about what is installed and where it is installed. By default, the Select-VSSetupInstance cmdlet queries Visual Studio products but other products can be selected.
Note that the following examples specify the line continuation character ``` to correctly wrap commands, but this is unnecessary when working interactively in PowerShell: just type everything on one command if you wish.
In many cases you may need to select the latest instance of a particular version.
Get-VSSetupInstance `
| Select-VSSetupInstance -Version '[15.0,16.0)' -LatestThis would select the latest version of any edition of Visual Studio 2017 - Community, Professional, or Enterprise. You can also select instances that contain one or more workloads or components, such as the Visual C++ desktop workload.
Get-VSSetupInstance `
| Select-VSSetupInstance -Require Microsoft.VisualStudio.Workload.NativeDesktop -Latest `
| Select-Object -ExpandProperty InstallationPathThe previous example extracts just the installation path to with as you need.
You can also use the same query capabilities for other products such as Build Tools.
Get-VSSetupInstance `
| Select-VSSetupInstance -Product Microsoft.VisualStudio.Product.BuildTools -LatestCopyright (C) Microsoft Corporation. All rights reserved. Licensed under the MIT license. See LICENSE.txt in the project root for license information.