Bagikan melalui


How to: Prepare and Manage Builds

Visual Studio 2005 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.

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 Visual Studio Settings.

To build, rebuild, or clean an entire solution

  1. In Solution Explorer, select or open the desired solution.

  2. 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

  1. In Solution Explorer, select or open the desired project.

  2. 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

  1. On the Tools menu, choose Options.

  2. 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.

  3. 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 batch build multiple project configurations

  1. On the Build menu, choose Batch Build.

  2. Select the check boxes for the project configurations you wish to build.

  3. Choose Build or Rebuild.

To set save options for build commands

  1. On the Tools menu, choose Options.

  2. 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.

  3. Select an option in the Before building list.

To show feedback about builds

  1. On the Tools menu, choose Options.

  2. In the Options dialog box, expand the Projects and Solutions folder, and choose General.

    The General, Projects and Solutions, Options Dialog Box opens.

  3. If you would like the Output window to come to the top and show progress of builds, select Show Output window when build starts.

  4. 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

Concepts

Build Configurations

Projects as Containers

Reference

Configuration Manager Dialog Box

Devenv Command Line Switches

Other Resources

Building in Visual Studio

Building in Visual Studio

C/C++ Building Reference