Replies: 2 comments
-
Are the two dlls in the same directory? How does the DllImport look like? |
Beta Was this translation helpful? Give feedback.
0 replies
-
Yes, they get copied to the bin/Debug folder when built. Example of a method. [DllImport("device.dll")]
private static extern int Device_Open(int portNumber, string baudRate);
public static void Open(int portNumber, string baudRate)
{
Device_Open(portNumber, baudRate);
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Version Used: Visual Studio 2019 16.8 Preview 1
This is more of a question, but seems to be an issue.
I have a .NET 4.7.2 Class Library that depends on a native DLL in same location that uses DllImport to call methods. I tried right-clicking the project in Solution Explorer and selecting "Initialize Interactive with Project" and is loaded in C# Interactive. However, when calling methods that call the DllImport methods within, it appears to throw errors like it can't find/load the native DLL.
"System.DllNotFoundException: Unable to load DLL 'xxx.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"
I can use the Class Library project with no problems in a WPF or Console app.
How can I make sure the native DLL is located in the required location when using my Class Library project in C# Interactive and in script files (csx)?
Any help is appreciated.
Beta Was this translation helpful? Give feedback.
All reactions