Setting up Third Party .NET dll in visual studio with C#



I am developing a large application with Visual Studio .NET 2003 using C#. We
recently added a new third party product with a native .NET library. I want
to place this third party product's dll in a VS Project of its own, and then
reference that project from those c# projects in my solution that are
dependent on the third party product.

I created a c# class library project, ThirdPartyDll. Placed the dll file in
question into that project's directory and added it to my project. I removed
all other files in the project, and all references. The dll has the build
action of "content".

So far, so good (well, maybe not)

I go to the project that needs to reference this third party library and add
a project reference to my third party class library project ThirdPartyDll.
But, now I try to find the right "using" statement in my c# for ThirdPartyDll
and can not find a string that Visual Studio will properly resolve?

What am I doing wrong?

What is the "right" way to create a Visual Studio project to wrap an
existing dll such that I can include that project in any projects that must
reference its functionality?

Jianwei Sun

I am not sure why you want to do it that way, just simply reference this
dll in your project.

Robbe Morris [C# MVP]

What you are trying to do is senseless. Just add a reference
to those "real" projects that need to use it. You aren't going
to get away from adding a reference in those projects that need it.


I want to include the dll in the solution as it is under source control just
like the rest of the solution. The intended behavior is that when the
solution is "Opened from Source Control", the dll will be fetched/checked-out
along with all of the source files in the "normal" projects.

The technique I've described has been used with other third party products,
but this is the first that I've been responsible for adding, and of course
mine does not work while the others do.

If I just add a direct reference to the file, with the file placed in some
arbitrary location in the source code tree, wouldn't it be omitted from an
"Open From Source Control"?


I just figured out what I have wrong and it turns out to be pretty simple.
The problem is that I named the project that contains the dll in question in
such a way that it colides with the namespace defined in the dll. If I rename
my dll project to avoid this collision, everything works properly, just as it
already does for other dlls handled in this way.

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question