How does a project find dlls that it uses - where do I put them?

H

HONOREDANCESTOR

I am using some dlls from a third party, and I am writing a
multiproject solution that is supposed to use them. So I copied the
dlls to a bin directory in one of the projects, but the project does
not find them when I compile it.
Where should I put the dlls? Should I use 'add / reference'?
Thanks,
HA
 
H

Herfried K. Wagner [MVP]

I am using some dlls from a third party, and I am writing a
multiproject solution that is supposed to use them. So I copied the
dlls to a bin directory in one of the projects, but the project does
not find them when I compile it.
Where should I put the dlls? Should I use 'add / reference'?

If the DLLs are mainly used by a single application, put them in the
directory containing the executable file. Otherwise you can install the DLL
into the Global Assembly Cache (GAC) in order to enable more than one
application to use the libraries.

At design time simply add a reference to the DLL.
 
T

Trevor Benedict

and to explicitly copy the dll to the bin folder, right click on the
Referenced library and make sure the Copy Local is set to True.

Regards,

Trevor Benedict
MCSD
 
P

Phill W.

Trevor said:
and to explicitly copy the dll to the bin folder, right click on the
Referenced library and make sure the Copy Local is set to True.

Given that I've spent an inordinate amount of my time trying to get rid
of this "Copy Local" option, may I ask why you recommend this?

If I've built and distributed a "shared" assembly, I'd far rather it was
safely in the GAC, stored once and re-used all over the machine, rather
than having loads of [potentially incompatible] copies of it springing
up all over the place ...

Regards,
Phill W.
 
T

Trevor Benedict

Phill,
I did not mean it as a recommendation, an available option was highlighted.

What are the requirements for an assembly to reside in the GAC. Whenever you
wrap an assembly without a strong name you don't have an option.

Moreover, xcopy becomes easier when the files are in one location.

Regards,

Trevor Benedict
MCSD
 

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

Top