How can I load a dll of unmanaged code in a WCF project?
I am trying to load a c dll using DLL import in a WCF project but I keep getting a DLLNotFoundException. I have placed the .dll in the bin folder of the webservice projectt but it can't find it. Where should 开发者_如何学运维I place the .dll?
Here is a snippet:
public class DllProcessLauncher {
[DllImport(@"Engine.dll")]
public static extern int Name();
[DllImport(@"Engine.dll")]
public static extern int Flowchart();
}
Here is a code that i am using to define the interface.
The DLLProcessLauncher is then called by a WCF C# project.
Try using an absolute path for the DLL, that should work. Unfortunately it has to be a constant value, so it can't be configured in a config file or similar:
[DllImport(@"C:\lib\Engine.dll")]
public static extern int Name();
精彩评论