DLL 未找到:引用依赖 DLL

发布于 2024-12-03 03:37:03 字数 360 浏览 0 评论 0原文

我正在尝试实现一个 C++ DLL(我自己创建的),它在 C# 表单应用程序中使用英特尔性能原语。当我尝试运行该程序时,出现“DLL Not Found Exception”。本网站其他帖子中提出的一个可能的原因是,存在必须引用的依赖 DLL,事实上,在下载 DpendencyWalker 后,我发现我的 DLL 使用“IPPS-7.0.DLL”。

我的问题是我不清楚如何引用这些依赖的 DLL。我已将包含文件夹的 IPPS-7.0.DLL 添加到引用路径,并添加了对“IntelCppOptPkg”和“IntelLibOptPgk”程序集的引用,但这并没有解决问题。

那么,我认为这就是问题所在吗?如果是这样,如何在托管代码中引用依赖的 DLL?

谢谢。

I'm attempting to implement a C++ DLL (of my own creation) that uses the Intel Performance Primitives in a C# forms application. I'm getting a "DLL Not Found Exception" when I attempt to run the program. One possible reason put forward in other posts on this site is that there are dependent DLLs that must be referenced and in fact after downloading DpendencyWalker I found that my DLL uses "IPPS-7.0.DLL".

My problem is that it is unclear to me how to reference these dependent DLLs. I've added the IPPS-7.0.DLL containing folder to referenced paths as well as added references to the "IntelCppOptPkg" and "IntelLibOptPgk" assemblies but this has not solved the problem.

So, am I correct in believing this is the problem? And if so, how does one reference a depedent DLL in managed code?

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

蓦然回首 2024-12-10 03:37:03

您不引用它们,它们不是 .NET 程序集。您只需确保 DLL 被复制到您的构建目录即可。最简单的方法是使用“项目”+“添加现有项”,从复制的位置选择 DLL。然后选择添加的文件,并在“属性”窗口中设置“构建操作 = 内容”、“复制到输出目录”= 如果较新则复制。顺便说一句,在源代码管理中签入 DLL 通常是一个好主意。

You don't reference them, they are not .NET assemblies. You just need to make sure that the DLL(s) get copied to your build directory. Easiest way to do that is with Project + Add Existing Item, select the DLL from wherever it was copied. Then select the added file and in the Properties window set Build Action = Content, Copy to Output Directory = Copy if newer. Checking-in the DLL(s) in source control is generally a good idea btw.

度的依靠╰つ 2024-12-10 03:37:03

托管代码不能像引用托管程序集那样引用非托管 dll。托管引用实际上更改了程序集的元数据:

编译器记录静态
构建时程序集清单元数据中的引用。
...
引用程序集的首选方法是使用完整引用,
包括程序集名称、版本、区域性和公钥令牌
(如果存在的话)。

本机 dll 根本没有与之关联的 .NET 元数据。必须在构建后步骤或部署期间手动复制它们。有一个 解决方法,但如果您的托管应用程序是平台独立的(任何 CPU)并且您有 x86 和 x64 版本的非托管应用程序,我认为它不会起作用dll。

Managed code can not reference unmanaged dll the same way it references managed assemblies. Managed references actually change the meta data of your assembly:

The compiler records static
references in the assembly manifest's metadata at build time.
...
The preferred way to reference an assembly is to use a full reference,
including the assembly name, version, culture, and public key token
(if one exists).

Native dlls simply don't have this .NET meta data associated with them. They have to be copied manually in the Post Build step or during deployment. There is a workaround but I don't think it will work if your managed app is platform independent (Any CPU) and you have x86 and x64 versions of unmanaged dlls.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文