'Best way to extract list of Visual studio 2017 installed components
What would be the best way to list installed components of my Visual studio 2017 installation ?
I know I can start the Visual Studio Installer > Modify and review the Workloads or Individual components there.
But there doesn't seem to be a way to extract the list of installed components to a txt file ?
(I'm making screenshots now to document what I have)
Is there any way ? E.g. can I run the Windows Studio Installer commandline perhaps ?
Solution 1:[1]
Based on the great answer from https://stackoverflow.com/a/45330187/902415
Here is the non-interactive snippet that works also for VS Build Tools
(not just Community\Professional\Enterprise)
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module VSSetup -Scope CurrentUser -Force
(Get-VSSetupInstance | Select-VSSetupInstance -Product *).packages
It's also worth mentioning the origin of this module: https://github.com/Microsoft/vssetup.powershell.git
If you are hoping to use this information to do a scripted (re)installation of workloads/components, you may not care about the specific component level (MANY components get pulled in automatically) and you probably care more about "Workloads".
The full list is available in the Microsoft documentation and you can change the version to reflect vs 2019 pro or vs 2017 buildtools or whatever. https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-professional?view=vs-2019
This is the command to pull out the list of workloads that were installed (3 workloads vs 564 components....).
(Get-VSSetupInstance | Select-VSSetupInstance -Product *).packages | Where-Object { $_.Id -like '*Workload*' } | select -ExpandProperty Id
As noted in the comment, you can easily pipe just the Ids to a file and then loop over those in an installation script (I use ascii as the encoding because it is more compatible across editors).
(Get-VSSetupInstance | Select-VSSetupInstance -Product *).packages | Where-Object { $_.Id -like '*Workload*' } | Select -ExpandProperty Id | Out-File -Encoding ascii -FilePath $HOME/vs-packages.txt
Solution 2:[2]
Install powershell 5 from the WMF 5.0
In posh console run these 2 commands:
Install-Module VSSetup -Scope CurrentUser (allow nuget to install a package)
(get-vssetupinstance | select-vssetupinstance).packages
Solution 3:[3]
With newer versions (at least 2019) you can export your settings directly from the VS Installer. In the "More" dropdown you have the possibility to export and import the current configuration for each individual VS install you have on your machine.
Source: https://docs.microsoft.com/en-us/shows/visual-studio-toolbox/visual-studio-installation-and-customization (starting at 07:51)
Solution 4:[4]
More detailed explanation following Markus Deibel's hint
For VS2019
- Open Visual Studio Installer from Start Menu > Installed > More > Export/Import
- From within VS2019: Tools > Get Tools and Features > (x) Close modal > Installed > More > Export/Import
Store in a file e.g. .vsconfig. You can open in text editor, it lists all components. You can store it in SCM and import it in another VS2019 for project wide consistent IDE installations.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | dragon788 |
| Solution 2 | Peteski |
| Solution 3 | |
| Solution 4 | chrislro |
