Bagikan melalui


Project Dependencies Dialog Box

When building a solution, it can be necessary to build certain projects first, to generate executable code used by other projects. Use the Project Dependencies dialog box to set display the current build order. To access the Project Dependencies dialog box, select a project in the Solution Explorer, then choose Project Dependencies from the Project menu.

The Project Dependencies dialog box presents two tabs, Dependencies and Build Order.

Dependencies

The Dependencies tab makes it possible for you to determine which projects in the active solution must be built first. Setting project dependencies stipulates the desired build order for projects.

  • Project
    Select any project from this list that consumes executable code generated by another project.

  • Depends on
    Select the check box beside any project that generates executable code consumed by the project indicated in the Project list. The build order of projects not selected is not constrained by the project in the list.

Before building a solution, confirm that all project dependencies have been selected in the Configuration Manager dialog box to be built by the active solution build configuration. For more information, see Configuration Manager Dialog Box.

Warning

Selecting projects on the Dependencies tab of the Project Dependencies dialog box does not guarantee that all projects selected will be built. Only those projects whose Build check boxes are selected in the active solution build configuration are actually built.

Build Order

The Build Order tab displays the sequence in which projects will be built by the active solution build configuration, given the project dependencies currently set. To change the build order of the projects listed, select the Dependencies tab. For more information, see How to: Create and Remove Project Dependencies or How to: Create Solution and Project Build Configurations.

Dependencies in the Solution Property Pages Dialog Box

You also can access dependencies settings from the Project Dependencies, Common Properties, Solution Property Pages dialog box. To access this dialog box, select a solution in Solution Explorer, choose Property Pages on the View menu, and then select Project Dependencies under Common Properties. Changes made in the Dependencies tab are reflected on the Project Dependencies, Common Properties, Solution Property Pages dialog box, and vice versa. For more information, see Project Dependencies, Common Properties, Solution Property Pages Dialog Box.

About Project Dependencies

When a project consumes executable code generated by another project, the project that generates the code is referred to as a project dependency of the project that consumes the code. Whenever a project dependency has not been built or has been modified since the most recent build, that project is built first, to generate and update the code to be consumed.

For example, if project B requires executable code generated by its "project dependency" project A, and you have modified project A since the last build, then project A is rebuilt before project B is built. This makes it possible for the executable code provided by project A to be revised before project B consumes it.

If project A has not been modified since the last build, then a fresh rebuild of project A is not needed. Only project B is built.

Projects can appear dimmed on the Dependencies tab with their check boxes cleared. These projects cannot be checked because doing so would create a loop of dependencies (P1 dependent upon P2, P2 dependent upon P1) and stall the build.

Projects also can appear dimmed on the Dependencies tab with their check boxes selected. These projects have been added by the integrated development environment (IDE) and cannot be changed. For example, adding a project reference from a Visual Basic project to another project automatically adds a build dependency that can be removed only by deleting the reference.

See Also

Tasks

How to: Edit Common Properties for Solutions

How to: Prepare and Manage Builds

Concepts

Item Management in Projects

Build Configurations

Projects as Containers

Reference

Configuration, Configuration Properties, Solution Property Pages Dialog Box

Other Resources

Solution Property Pages Dialog Box

Building in Visual Studio