Use Project References Whenever Possible

- J.D. Meier, Jason Taylor, Alex Mackman, Prashant Bansode

You should use a project reference whenever possible because they provide the following advantages:
  • They work on all development workstations where the solution and project set are loaded. This is because a project Globally Unique Identifier (GUID) is placed in the project file, which uniquely identifies the referenced project in the context of the current solution.
  • They enable the Visual Studio build system to track project dependencies and determine the correct project build orders.
  • They help you avoid the possibility of referenced assemblies being missing on a particular computer.
  • They automatically track project configuration changes. For example, when you build using a debug configuration, any project references refer to debug assemblies generated by the referenced projects, while they refer to release assemblies in a release configuration. This means that you can automatically switch from debug to release builds across projects without having to reset references.
  • They enable Visual Studio to detect and prevent circular dependencies.

You can use a project reference if the assembly is already within your solution’s project set. If the assembly is outside of your solution’s project set and you still want to use a project reference, you can branch the dependency from the originating project into your project. When you want to pick up a new version of the dependency, perform a merge from the originating project into your branch.

Additional Resources

Last edited Jul 26, 2007 at 9:54 AM by prashantbansode, version 4


No comments yet.