views:

988

answers:

2

Hope I'm asking this correctly:

I have a project

Projects.Client

I have my class library ( infrastructure stuff I use all the time )

Library

Assuming these are both projects, how can I do this from a class in the "Projects.Client"

using Library;

public class xxx
{
    public void DoSomething()
    {
        Library.SomeDll.DoSomething();
    }
}

SomeDll.dll is referenced in the "Library" project. "Library" is a reference in end client project "Projects.Client"

I know I could simply add SomeDll to the "Projects.Client" project but there are a number of items and I use them all the time. I'd like to be able to include the "Library" and somehow be able to reference everything within it(including raw code and dll's). Is this possible?

please note: I'd prefer not to write explicit wrappers for all the methods and the dll is static so I can not seem to get away with doing this in the "Library" project:

public static class WrapSomeDll
{
    public static extern SomeDll Dll();
}

Any inventive answers are appreciated, I might not even need dual references, wrappers e.t.c.

+1  A: 

Sorry, that doesn't work. You need the reference to SomeDll in order to use its metadata in Project.Client. It's really as simple as that.

Keep in mind that references aren't just a matter of resolving symbols to addresses. This is a matter of pulling over the metadata (types) so that it can be used.

John Saunders
thanks, I wish there was a way to do it though, so I don't have to always re-import the same references in every project I do.
5x1llz
Try recording a macro while you do Add Reference. If that doesn't help, get the Visual Studio SDK and learn enough to learn how to add a reference to a project. Otherwise, create your own project template that already has the references.
John Saunders
A: 

You just need to reference the project and add using clauses for the namespaces you want to use. There is no need to specify the name of the DLL

Thomas Levesque
Doesn't work unfortuantely, this is what I assumed myself.when I do the using, it doesn't automatically wire up ALL the namespaces in the referenced projects. So the DLL is in another project. If I am only refrencing the project, how can I access the "child" dll using a using statement?
5x1llz
I don't understand what you mean... "using" isn't used to reference a DLL, only to import a namespace in the code file.
Thomas Levesque