Visual C++

Warning disabling

To disable a warning once :

#pragma warning( suppress : <warning> )

with <warning>, the number of the warning (without the heading C).

Example :

#pragma warning( suppress: 4065 )

Compilation from CLI

Using 'MSBuild.exe'

To install this executable and other needed files, see the Installation section.

To compile a Visual C++ solution or project from the CLI, launch :

  • for Visual Studio 2017: : "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe" /property:Configuration=Release /property:Platform=Win32 /t:Rebuild,
  • for Visual Studio 2013 : "C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe" “<file>” /property:Configuration=Release /property:Platform=Win32 /t:Rebuild

where <file> is the solution (.sln extension) or the project (.vcxproj extension) file name.

This will rebuild (i.e. force the building) the project/solution in the Release configuration for the Win32 plateform.

Using 'WDExpress.exe'

It seems that you can not Rebuild (i.e. force the building) of a solution/project (the /rebuild switch isn't recognized), so better use MSBuild.exe, as explained above.

To compile a Visual C++ solution or project from the CLI, launch (with Visual C++ Express 2013) :

"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\WDExpress.exe" <file> /build

where <file> is the solution (.sln extension) or the project (.vcxproj extension) filename.

To compile for a specific configuration/platform, add “<configuration>[|<platform>]” argument. Example :

"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\WDExpress.exe" MySolution.sln /build "Release|Win32"

Offline installation

2017

Community

  • Download Community version,
  • launch vs_community__<…>.exe --layout <path>, where <path> is the path where to put the downloaded files (you can add --lang en-US, for example, to download one language only),
  • launch each file from the certificates directory,
  • launch vs_community__<…>.exe, the one which located in the above <path>.

To update the downloaded files, relaunch vs_community__<…>.exe --layout <path> (:!: it seems to reload everything !).

Build tools

This are the tools to build a solution/project outside from the IDE (contains msbuild.exe). They will be found on the Visual Studio download page, under Other Tools and Framework/Build Tools for Visual Studio 2017. The executable is named vs_buildtools__<…>.exe and can be handled the same way as the above one.

Older version (Express)

By default, the executable to install VS (like wdexpress_full[_ENU].exe) is a small one which connects to an Internet site to download files.
To retrieve the needed files in order to install VS offline, launch this executable with the /layout option. You will then be asked for a download directory, and the needed files will be put there.