简体   繁体   English

.net dllimport DllNotFoundException但dll确实存在。

[英].net dllimport DllNotFoundException but the dll is indeed there.

I'm using DllImport in my c# application. 我在我的c#应用程序中使用DllImport It works fine on my windows 7 machine, but on a windows 8 it gives the DllNotFoundException. 它在我的Windows 7机器上工作正常,但在Windows 8上它给出了DllNotFoundException。

A customer of our has the same issue on his windows 7 machine. 我们的客户在他的Windows 7机器上有同样的问题。

I even hacked the code just to test it out by supplying the absolute path like so 我甚至通过提供像这样的绝对路径来破解代码来测试它

[DllImport("C:\\Program Files (x86)\\MyApp\\A.dll", CallingConvention = CallingConvention.Cdecl)]
private static extern void foo(string filename, MulticastDelegate callback);

But it still gives the DllNotFoundException at the path C:\\Program Files (x86)\\MyApp\\A.dll .... 但它仍然在路径C:\\ Program Files(x86)\\ MyApp \\ A.dll ....提供DllNotFoundException。

But the DLL is indeed there!!! 但DLL确实存在! .... ....

路径有空格,所以我的猜测是使用:

[DllImport("\"C:\\Program Files (x86)\\MyApp\\A.dll\"", ...]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM