Ways to Build
命令行编译.sln
MSBuild Sample.sln /t:Clean /p:Configuration=Debug /p:Platform=x64
MSBuild Sample.sln /t:Rebuild /p:Configuration=Debug /p:Platform=x64
MSBuild Sample.sln /t:Build /p:Configuration=Debug /p:Platform=x64
MSBuild -noLogo Solution.sln /t:projectName /p:Configuration=Debug /p:Platform=x64
MSBuild -noLogo Solution.sln /t:projectName:clean /p:Configuration=Debug /p:Platform=x64
MSBuild -noLogo Solution.sln /t:projectName:rebuild /p:Configuration=Debug /p:Platform=x64
MSBuild -noLogo Solution.sln /t:build
MSBuild -noLogo Solution.sln /t:clean
MSBuild -noLogo Solution.sln /t:rebuild
MSBuild.exe MultiProjectSolution.sln /t:"ProjectName:clean"
Command-line project management tools
By default, the Visual Studio IDE uses native project build systems based on MSBuild. You can invoke MSBuild directly to build projects without using the IDE. You can also use the devenv command to use Visual Studio to build projects and solutions. Visual Studio also supports build systems based on CMake or NMake.
MSBuild
Use MSBuild (msbuild.exe) and a project file (.vcxproj) to configure a build and
invoke the toolset without loading the Visual Studio IDE.
It's equivalent to running the Build project or Build Solution command in the Visual Studio IDE.
MSBuild has advantages over the IDE when you build at the command line.
You don't have to install the full IDE on all your build servers and build pipelines.
You avoid the extra overhead of the IDE.
MSBuild runs in containerized build environments, and supports a binary logger.
DEVENV
Use DEVENV (devenv.exe) combined with a command-line switch such as
/Build or /Clean to execute certain build commands without displaying the Visual Studio IDE.
CMake
CMake (cmake.exe) is a cross-platform, open-source tool for defining build processes that run on
multiple platforms. CMake can configure and control native build tools for its supported platforms,
such as MSBuild and Make. For more information about CMake, see the CMake documentation.
NMAKE
Use NMAKE (nmake.exe) to build C++ projects by using a traditional makefile.
Note
Starting in Visual Studio 2019 version 16.5, MSBuild and DEVENV don't use the command-line environment
to control the toolset and libraries used.