How to: Prepare and Manage Builds
Visual Studio offers a variety of ways to help you organize what files are included in a build of a solution or project and which set of project properties is in effect while building. This section contains topics that explain various procedures for preparing and managing builds.
How to: Change the Build Output Directory
Explains how to change the output directory.How to: Build to a Common Output Directory
Describes how to configure your solution to build to a common output directory.How to: Customize Build Events
Contains links to topics that describe how to customize build events.How to: Set Multiple Startup Projects
Describes how to set multiple startup projects.How to: Create and Remove Project Dependencies
Explains how to create and remove project dependencies.
The following are common Visual Studio procedures for preparing and managing builds.
Note
The options available in dialog boxes, and the names and locations of menu commands you see, might differ from what is described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Working with Settings.
To build, rebuild, or clean an entire solution
In Solution Explorer, select or open the desired solution.
On the Build menu, choose Build Solution, Rebuild Solution, or Clean Solution.
Choose Build or Build Solution to compile only those project files and components that have changed since the last build.
Note
The Build command becomes Build Solution when a solution includes more than one project.
Choose Rebuild Solution to "clean" the solution first, and then build all project files and components.
Choose Clean Solution to delete any intermediate and output files, leaving only the project and component files, from which new instances of the intermediate and output files can then be built.
To build or rebuild a single project
In Solution Explorer, select or open the desired project.
On the Build menu, choose Build [Project Name] or Rebuild [Project Name].
Choose Build [Project Name] to build only those project components that have changed since the last build.
Choose Rebuild [Project Name] to "clean" the project first, and then build the project files and all project components.
To build only the startup project and its dependencies
On the Tools menu, choose Options.
In the Options dialog box, expand the Projects and Solutions folder, and choose Build and Run.
The Build and Run, Projects and Solutions, Options Dialog Box opens.
Select the option to Only build startup projects and dependencies on Run.
When this option is selected, only the current startup project and its dependencies are built when you:
choose Start (F5) from the Debug menu.
-or-
choose Build Solution (CTRL+SHIFT+B) from the Build menu.
When this option is cleared, either of the preceding command builds all projects, their dependencies, and the solution files. By default, this option is not selected.
To build only the selected Visual C++ project
For Visual C++ projects only, a Project Only submenu of the Build menu displays three project-specific commands:
Build Only <projname>
Rebuild Only <projname>
Clean Only <projname>
Link Only <projname>
These commands build, rebuild, clean, or link the Visual C++ project currently selected in Solution Explorer, without building, rebuilding, cleaning, or linking any project dependencies or solution files. Depending on the version of Visual Studio you have installed, you may have additional commands available on the Project Only submenu.
To compile multiple C++ project items
Selection files that have a valid compile action in Solution Explorer.
Right click one of the selected items to open a context menu.
Choose Compile from the context menu. The files will be compiled in dependency order, if the files selected have dependencies. The compile will fail if the files require a precompiled header that is not available at the time of the build. The compile uses the current active configuration.
To batch build multiple project configurations
Use the Batch Build command to build selected project configurations all at once. Only the projects selected will be built.
On the Build menu, choose Batch Build.
Select the check boxes for the project configurations you wish to build.
Choose Build or Rebuild.
To set save options for build commands
The save options for projects and solutions determine whether unsaved changes will be included as you build projects and solutions while you are editing them.
On the Tools menu, choose Options.
In the Options dialog box, expand the Projects and Solutions folder, and choose Build and Run.
The Build and Run, Projects and Solutions, Options Dialog Box opens.
Select an option in the Before building list.
To show feedback about builds
The show options for projects and solutions determine what information will be displayed as you build projects and solutions.
On the Tools menu, choose Options.
In the Options dialog box, expand the Projects and Solutions folder, and choose General.
The General, Projects and Solutions, Options Dialog Box opens.
If you would like the Output window to come to the top and show progress of builds, select Show Output window when build starts.
If you want to see all the errors from a build in the Task List when the build is done, select Always show Error List if build finishes with errors.
See Also
Reference
Configuration Manager Dialog Box