Question: How should I manage dependencies between projects?

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

Answer

If you need to reference an external assembly that is not built as part of your Visual Studio solution, such as a third-party assembly for which you only have the binary dynamic-link library (DLL), you have the following three choices:
  • You can store the external assembly as a binary resource as part of your project. This works well if you plan to maintain the dependency for other projects that might want to reference it, or if yours is the only project that relies on this dependency.
  • You can reference an assembly on your build server by using either a virtual drive letter or a Universal Naming Convention (UNC) path.
  • You can store the set of external assemblies in a folder in a shared team project. This approach works well if there are many projects that want to reference this shared dependency and your project is not the clear owner of it.
    • If you want to receive immediate updates to the binary when it is changed, you can create a workspace mapping for this team project to your local computer. You can set a file reference to the assembly within your local file structure.
    • If you want to control the integration schedule for this dependency, you can create a branch from the shared project into your project and then merge whenever you are ready to pick up changes.

In general, you should avoid dependencies that cross team projects, and instead try to have all the related/dependent solutions/projects under the same team project. This reduces the need for build script customization. If you have a dependency, use project references to define the dependency. You should avoid file references because they are more difficult to manage.

Note: Project-to-project references are supported within a solution. Also note that a project file (csproj, vjsproj, vcproj, vbproj, etc) can be included by multiple solutions (sln files), so a project can be shared by multiple separate solutions.

Additional Resources


Last edited Jul 18, 2007 at 11:03 PM by jtaylorsi, version 6

Comments

No comments yet.