Building and Cleaning Projects and Solutions in Visual Studio
For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.
By using the procedures in this topic, you can build, rebuild, or clean all or some of the projects or project items in a solution. For a step-by-step tutorial, see Walkthrough: Building an Application.
The UI in your edition of Visual Studio might differ from what this topic describes, depending on your active settings. To change your settings, open the Tools menu, and then choose Import and Export Settings. For more information, see Customizing Development Settings in Visual Studio.
In Solution Explorer, choose or open the solution.
On the menu bar, choose Build, and then choose one of the following commands:
Choose Build or Build Solution to compile only those project files and components that have changed since the most recent build.
The Build command becomes Build Solution when a solution includes more than one project.
Choose Rebuild Solution to "clean" the solution and then build all project files and components.
Choose Clean Solution to delete any intermediate and output files. With only the project and component files left, new instances of the intermediate and output files can then be built.
In Solution Explorer, choose or open the project.
On the menu bar, choose Build, and then choose either BuildProjectName or RebuildProjectName.
Choose BuildProjectName to build only those project components that have changed since the most recent build.
Choose RebuildProjectName to "clean" the project and then build the project files and all project components.
On the menu bar, choose Tools, Options.
In the Options dialog box, expand the Projects and Solutions node, and then choose the Build and Run page.
The Build and Run, Projects and Solutions, Options dialog box opens.
Select the Only build startup projects and dependencies on Run check box.
When this check box is selected, only the current startup project and its dependencies are built when you perform either of the following steps:
On the menu bar, choose Debug, Start (F5).
On the menu bar, choose Build, Build Solution (CTRL+SHIFT+B).
When this check box is cleared, all projects, their dependencies, and the solution files are built when you run either of the preceding commands. By default, this check box is cleared.
Choose a Visual C++ project, and then, on the menu bar, choose Build, Project Only, and one of the following commands:
Build Only ProjectName
Rebuild Only ProjectName
Clean Only ProjectName
Link Only ProjectName
These commands apply only to the Visual C++ project that you chose, without building, rebuilding, cleaning, or linking any project dependencies or solution files. Depending on your version of Visual Studio, the Project Only submenu might contain more commands.
In Solution Explorer, choose multiple files that have can be compiled actions, open the shortcut menu for one of those files, and then choose Compile.
If the files have dependencies, the files will be compiled in dependency order. The compile operation will fail if the files require a precompiled header that isn’t available when you compile. The compile operation uses the current active solution configuration.
Perform either of the following steps:
On the menu bar, choose Build, Cancel.
Choose the Ctrl + Break keys.
How to: View, Save, and Configure Build Log Files
Obtaining Build Logs
Compiling and Building
Understanding Build Configurations
Debug and Release Project Configurations
C/C++ Building Reference
Devenv Command Line Switches
Solutions and Projects