Quantcast
Channel: Dotnet/C# – Xinyustudio
Viewing all articles
Browse latest Browse all 204

P/Invoke “DllNotFoundException” Exception

$
0
0

When calling C functions with InterOp Invoke, although the C DLL is already in the same folder as the target assembly, however, it is common to see the “DllNotFoundException” Exception. One of the most possible reason is that the C DLL depends on other legacy DLLs, and such dependents are not in the same directory as the assembly. For instance, for the below Motor.DLL, it depends on four DLLs:

PInvokeDLL_A

Copy all the depended DLLs to the assembly output folder, and rebuild, all will be fine.


Posted in Dotnet/C#

Viewing all articles
Browse latest Browse all 204

Trending Articles