c# - 无法加载 DLL ' mydll.dll' : The specified module could not be found

标签 c# visual-studio-2010 dll dllimport

在我开发 WPF 应用程序的笔记本电脑上,一切正常,调试并启动 .exe 应用程序。

我的应用程序使用 native DLL,为了解决引用问题,我将 DLL 添加到 bin/debug(发布)文件夹中。我像这样使用 DllImport 访问它:

[DllImport("xptodll.dll", CallingConvention = CallingConvention.Cdecl)]
public static extern int LDA_About();

问题是当我尝试在另一台 PC 上运行 .exe 应用程序时,当我需要访问 DLL 时它崩溃了。我创建了一个句柄来记录任何未处理的异常,并出现以下错误:

Unable to load DLL ' xptodll.dll': The specified module could not be found. Exception from HRESULT: 0x8007007E)

bin/debug目录下有xptodll.dll,app文件有:.exe、.application、.exe.config、.exe.manifest、.pdb。

也许这很重要,xptodll.dll 与硬件交互,但为什么它在两台机器上的行为不同?

最佳答案

可能有一些进一步的依赖失败了。我的猜测是 xptodll.dll 本身依赖于故障机器上缺少的其他库。 xptodll.dll 的文档应该解释需要哪些依赖项。如果文档没有明确说明缺少什么,您可以使用 Dependency Walker 自行诊断问题。 .

关于c# - 无法加载 DLL ' mydll.dll' : The specified module could not be found,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8194914/

相关文章:

c# - MVC 3 : HTML. DisplayFor 和 Lambda 表达式

c# - 在 visual studio c# windows 窗体中使用 JavaScript

c++ - OpenCV C++ VS2010 : FindContours throws exception

mysql - 部署 C# 控制台应用程序时如何包含 MySql.Data.dll

C#.NET : how to pause and resume a program execution on a keypress?

c# - 如何在 .NET Core 中使用 HttpClientHandler 和 HttpClientFactory

c - C 中的 unsigned char 到 char* 和 int?

linux - linux/gcc 中是否有 rebase (dll) 命令?

c# - C# Windows 7 App System.DllNotFoundException 上的 AutoIt (AutoItX)

c# - 设计模式以适应处理 Winform 功能的两种不同方式