Question

My problem is that I have a Visual Studio (2010) C# solution with multiple projects and trying to manage the library for each one is nightmare. Each one of those project contains some standard library references (all pre-built).

For example:

Class Lib Project 1: A.dll, B.dll, C.dll
Class Lib Project 2: A.dll, B.dll, D.dll

So in this case, I have A.dll and B.dll beign references from a particular share drive. However, each new build of A.dll and B.dll goes into a separate folder. So if I want to upgrade to the latest library builds of A.dll and B.dll, I have to go through and change references in both projects to the new location.

Now if it was just 2 projects, no big deal. But if it's let's say 10+, then it becomes problematic, time-consuming, and error prone. Because this is a company wide process, I can't create like a directory link for a static location where latest library build would be copied to (and sometimes I don't want to automatically upgrade).

Does anyone know of a way where I can somehow centralize library references across projects under the same solution (I don't need it across solutions)?

Was it helpful?

Solution

I assume you are using source control? Add your references (binaries) to your solution and keep them stored locally, along with the source code.

References in Project

By keeping everything together you can always go back to a particular version of the source and be able to build it, without having to worry about what binaries you were using at that time.

Also, this allows you to update the binaries once - then all the developers can just pull down the latest ones whenever they do a "get".

Edit: If you do this you also can just keep one copy of the dll which can be referenced by multiple projects in your solution.

OTHER TIPS

When I work on complex projects (read solution with 10+ projects somehow cross dependent), normally I create in the solution root a DLL folder in which I store all the dlls used in the projects of the solution.

From each project I add the references from del these DLLs, with copy local option only for runnable projects (web apps, console...)

In this way if I want to upgrade A.dll I can update only in the common DLLs folder and rebuild the solution

- solution
 |-DLLs
 |  |- A.Dll
 |  |- B.Dll
 |  |- C.Dll
 |  |- D.Dll
 |- prj1
 |  |- References
 |  |   |- A.Dll
 |  |   |- B.Dll
 |  ...
 |- prj2
 |  |- References
 |  |   |- A.Dll
 |  |   |- B.Dll
 |  |   |- C.Dll
 |  ...
 |- prj3
 |  |- References
 |  |   |- B.Dll
 |  |   |- D.Dll
 |  ...

Normally the update of the libs dll (A.dll,B.dll,...) is done with a script (.bat or .ps1) so is somehow automatic but manually triggered. Anyway is possibile to trigger automatically this operation with a prebuild action

We use Nuget only for community libraries, although is possible to have a private nuget repository it's too much for enviroment.

NuGet is the way to go. You still have to manage them for each project (packages.config for each project) but it gives you a nice GUI to work at the solution level and it will update the projects in batch for you. More details here: http://frozenorange.wordpress.com/2011/10/12/managing-nuget-at-the-visual-studio-solution-level/

NuGet Solution Level

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top