← Back to context

Comment by debugnik

6 days ago

The Build Tools installer first installs the Visual Studio tool to select the workloads you want as well.

Let's say I want to compile a helloworld.cpp with no build tools installed yet.

What is the minimal winget command to get everything installed, ready for : cl main.cpp ?

Ps: I mean a winget command which does not ask anything, neither in command line, nor GUI ? Totally unattenfed.

  • The winget installer just downloads vs_buildtools.exe and runs it, which first installs vs_setup.exe and then that one prompts you for the workloads you want. I believe passing --silent to the winget installer will install vs_setup unattended but not any workloads from the Build Tools.

    To install it all in a single step, and beware I haven't tested this, you're better off downloading and running yourself

      vs_buildtools.exe --quiet --add Microsoft.VisualStudio.Workload.VCTools
    

    adding whatever workloads you need.

    Then you'll need to locate and run vcvarsall.bat to setup the environment, which will require some clever code if you're doing it from PowerShell instead of a .bat, and then you can finally call the compiler.