Visual C++ Build Tools silent installation

 

With the release of Visual Studio 2017, the creation of offline distribution files in order to achieve the Visual C++ build tools silent installation has become easier than in previous versions.

The key parameter is the –layout switch which allows to specify where you want to store the offline files.

The –lang switch is very useful as some options will download localized versions for several languages you may have no need for, e.g. the various .NET framework redistributables.

The –add can then be used to specify the components you want to store locally for future installations.

To compile C++ programs without too much hassle, as written down in the Visual C++ and build tools presentation article, you should use Microsoft.VisualStudio.Workload.VCTools keyword to install those tools.

<pre class="lang:batch decode:true " title="Offline creation of Visual C++ Build Tools">rem Target Directory = C:\VSBuildTools17
rem English only
rem Include all recommended and optional tools
vs_buildtools.exe --layout C:\VSBuildTools17 --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --includeOptional --lang en-US

Additionally, you can include recommended and optional software. In our case VC++ recommended and optional tools are as follows:

  • –includeOptional notably gives you the Windows 10 SDK, the CMake which are very useful to compile SDK samples.

Please note that the vs_build_tools.exe you can find on that download page will still result in creating a vs_setup.exe in the target directory.

You can also add –quiet so no window is displayed.

You can find the full list of command line parameters on Microsoft’s site.