PutBere
PutBere

Reputation: 141

How do I vs2019 for C++ from command line with a specified config file?

I'm aware that I can install vs2019 by checking the option in GUI interaction. Actually, I've setup a box this way. I'm trying another way.

enter image description here

Per ms doc I can do the job from command line.

vs_enterprise.exe --installPath C:\minVS ^
--add Microsoft.VisualStudio.Workload.CoreEditor ^
--passive --norestart

The command above would install a minimal instance of Visual Studio, with no interactive prompts but progress displayed.

How do I use this approach to install vs2019 for C++ from command line with a specified config file?

{
  "version": "1.0",
  "components": [
    "Microsoft.VisualStudio.Component.CoreEditor",
    "Microsoft.VisualStudio.Workload.CoreEditor",
    "Microsoft.VisualStudio.Component.NuGet",
    "Microsoft.VisualStudio.Component.Roslyn.Compiler",
    "Microsoft.Component.MSBuild",
    "Microsoft.VisualStudio.Component.TextTemplating",
    "Microsoft.VisualStudio.Component.IntelliCode",
    "Component.Microsoft.VisualStudio.LiveShare",
    "Microsoft.VisualStudio.Component.VC.CoreIde",
    "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
    "Microsoft.VisualStudio.Component.Graphics.Tools",
    "Microsoft.VisualStudio.Component.VC.DiagnosticTools",
    "Microsoft.VisualStudio.Component.Debugger.JustInTime",
    "Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
    "Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core",
    "Microsoft.VisualStudio.ComponentGroup.WebToolsExtensions.CMake",
    "Microsoft.VisualStudio.Component.VC.CMake.Project",
    "Microsoft.VisualStudio.Component.VC.ATL",
    "Microsoft.VisualStudio.Component.VC.TestAdapterForBoostTest",
    "Microsoft.VisualStudio.Component.VC.TestAdapterForGoogleTest",
    "Microsoft.VisualStudio.Component.VC.ASAN",
    "Microsoft.VisualStudio.Workload.NativeDesktop"
  ]
}

This configuration file is exported from vs2019 bootstrapper.

Upvotes: 2

Views: 1238

Answers (1)

dxiv
dxiv

Reputation: 17628

Previously saved .vsconfig installation configurations can be installed or added with the --config command line option. From the Using --config examples:

  • Using --config to install the workloads and components from a previously saved installation configuration file:

    vs_enterprise.exe --config "C:\.vsconfig" --installPath "C:\VS"
    
  • Using --config to add workloads and components to an existing installation:

    vs_enterprise.exe modify --installPath "C:\VS" --config "C:\.vsconfig"
    

The blog post Configure Visual Studio across your organization with .vsconfig has more about .vsconfig files, including how to associate one with an individual solution.

Upvotes: 3

Related Questions