Export (0) Print
Expand All

Preparing and Managing Builds

Visual Studio .NET offers a variety of ways to help you organize what files are included in a build of a solution or project, which set of project properties is in effect while building, and in what order projects will be built.

The following are common Visual Studio procedures for preparing and managing builds.

To build or rebuild an entire solution

  1. In Solution Explorer, select or open the desired solution.
  2. On the Build menu, choose Build Solution or Rebuild 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.
      Note   "Cleaning" a solution or project deletes 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 Environment folder, and choose Projects and Solutions.

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

  3. Under Build and Run Options, 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 one of the following commands:

    • choose Start (F5) from the Debug menu

      -or-

    • choose Build Solution (CTRL+SHIFT+b) from the Run 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, but it is enabled when the "Visual C++ Developer" profile is selected on the My Profile tab of the Start Page.

    Note   For more information on user profiles, see My Profile, Start Page.

To build only the selected C++ project

For Visual C++ projects only, a Project Only submenu of the Build menu displays three project-specific commands:

  • Build Only <projname> (Control+F7)
  • Rebuild Only <projname> (Control+Alt+F7)
  • Clean Only <projname> (Control+Shift+F7)

These three commands build, clean and build, or clean the C++ project currently selected in Solution Explorer, without building or cleaning any project dependencies or solution files.

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.

  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 make one project dependent on another

Project dependencies determine the order in which projects are built. If, for example, a project P2 requires resources from project P1, then P1 must be built before P2. Use the Project Dependencies Dialog Box to make P2 dependent on P1.

  1. Add at least two projects to your Solution.
  2. In Solution Explorer, select a project.
  3. On the Project menu, choose Project Dependencies.

    The Project Dependencies dialog box opens.

  4. Change the project in the Project list if you want to establish the dependencies of a different project.
  5. In the Depends on field, select another project that must be built before this project.
  6. To see the resulting order in which projects will build, click the Build Order tab.

To set the order in which projects are built

As you set dependencies within the Project Dependencies dialog box, select the projects in reverse order, beginning with the project you want to build last.

  1. Open the Project Dependencies dialog box.
  2. On the Projects dropdown menu, select the project you want to build last.
  3. In the Depends on field, select those projects that must be built before the one selected in the Projects menu.
  4. Return to the Projects menu, and select the project you want to build next-to-last.
  5. Under Depends on, select those projects that must be built before the one selected in the Projects menu.
  6. Continue this process until the only projects remaining are those without project dependencies.
  7. Select the Build Order tab in the Project Dependencies dialog box to view the order in which your projects will build.

To edit project properties

Project properties can vary by project configuration, or be independent of project configurations. Use the <Projectname> Property Pages Dialog Box to display configuration-related properties. Use the Properties Window to display properties that are not configuration-related.

  1. In Solution Explorer, select a project.
  2. On the Project menu, choose Properties.

    The <Projectname> Property Pages dialog box opens.

  3. Select the properties you want to edit, and enter the desired values.

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.

  1. On the Tools menu, choose Options.
  2. In the Options dialog box, expand the Environment folder, and choose Projects and Solutions.

    The Projects and Solutions, Environment, Options dialog box opens.

  3. Under Build and Run Options, select one save option: Save changes, Prompt to save changes, or Don't save changes.

To Show feedback about Builds

The Show options for Projects and Solutions determine what information will be displayed as you build projects and solutions.

  1. On the Tools menu, choose Options.
  2. In the Options dialog box, expand the Environment folder, and choose Projects and Solutions.

    The Projects and Solutions, Environment, 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 on build start.
  4. If you want to see all the errors from a build in the Task List when the build is done, select Show Task List window on build finish option.

See Also

Default and Custom Builds | Build Configurations | Configuration Manager Dialog Box | Projects as Containers | Default and Custom Builds | C/C++ Building Reference | Build, Configuration Settings, <Projectname> Property Pages Dialog Box | Editing Project Properties | Devenv Command Line Switches

Show:
© 2014 Microsoft