tags:

views:

297

answers:

5

If I have an assembly (A) which references another assembly (B). I want to reference A in a project, I add the reference and it copies A into my BIN directory. It does not copy B as well, even though A depends on it, so the code doesn't compile. How can I set things up so that whenever I reference A, both A and B get copied to my bin directory?

+4  A: 

In Visual Studio, add each project to the same solution. Ensure you use Project References instead of direct file references (ie browsing for the assembly).

Ash
+1  A: 

Reference both A and B.

Justice
+3  A: 

I dont think there is any way around what you ask other than to explicitly add both. I dont think however adding projects for the sake of getting references copied is a viable solution to the issue. Not all projects that a solution depends on should necassarily be added to the solution. This would completely depdend on your overall project structure, processes, source control, division of labour, etc

mattlant
A: 

Unfortunately you'll have to manually add both. This is what happens to me as well whenever I use pre-3.5 versions of NHibernate: it requires both log4net and Iesi.Collections assemblies. So I have no choice but to manually include a reference to both in all my solutions that implement NHibernate.

This is more of an issue, of course, if you only have the DLLs. If it's a project that you have a codebase to Visual Studio itself will warn you beforehand that the references are missing.

Jon Limjap
Apparently there's a Telerik control that when you browse to the dll and add it, it adds a number of other required assemblies. I've not seen it, was told by another programmer. Would be a nice trick to know if it's possible.
Stephen Price
A: 

How about adding them to Global Assembly Cache?

danijels