Is there a way to tell a C# Application, where it can find some of his dependencies (DLL’s)?

  assembly, c++, ddl, path, windows

I build a Trace Embedder which can embedd code by manupulation the instruction language (IL) directly in a C# application without the need of the whole project. So basically I only need a executable X and nothing more for that. Still one problem remains, when I embedd some classes from another DDL, X must resolve the classes by using their DLL. But how can I tell X exactly where this DLL is? Is there any tool out there, how I can tell X where to search for the needed DLL’s? Would it maybe work when I add the complete path of the DLL to the environment variable (PATH)?

I already tried to use ”il-repack”, so basically merge the Executable with the DLL, it works for some applications, but not for all. Some applications work, when the DLL’s are placed in the same directory, but not all of them.

Thanks for any help!

Source: Windows Questions