Specify the search path for DllImport in .NET

Posted by Stefan on Stack Overflow See other posts from Stack Overflow or by Stefan
Published on 2010-05-19T10:34:41Z Indexed on 2010/05/19 13:10 UTC
Read the original article Hit count: 863

Filed under:
|

Is there a way to specify the paths to be searched for a given assembly that is imported with DllImport?

[DllImport("MyDll.dll")]
static extern void Func();

This will search for the dll in the app dir and in the PATH environment variable. But at times the dll will be placed elsewhere. Can this information be specified in app.config or manifest file to avoid dynamic loading and dynamic invocation?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about dllimport