How to set C# library path for an application?

Tamara picture Tamara · Mar 10, 2009 · Viewed 16.1k times · Source

I have C# application that uses a dll. When I try to run the application, it can't find the dll, unless it is in the same directory or in GAC. I do not want to have it in the same directory and I do not want to install it to GAC. Is there any way how to tell the application where to look for the library? (For example if I want to distribute the application to customers and they want to use their own applications that would use the dll.)

Added:

I would like to have this file structure:

MainFolder: Libraries, Applications

Libraries: lib.dll

Applications: app1.exe

I don't want to copy it to GAC or have lib.dll in folder Applications. Is it possible?

Answer

GvS picture GvS · Mar 10, 2009

I would recommend that the applications of your customers copy the dll's they use in their own directory.

VB6 used to share dll's between applications, we have a term for this: DLL Hell