简体   繁体   English

如何将包装器 DLL 连接到 API DLL 以在 C# 项目中使用?

[英]How to connect wrapper DLL to the API DLL for use in the C# project?

I use Dynamic Audio Normalizer for my WF solution to normalize audio file volume.我使用Dynamic Audio Normalizer作为我的 WF 解决方案来规范化音频文件音量。 It has two .dll libraries that must be connected to the project for usage.它有两个 .dll 库,必须连接到项目才能使用。 One of them - .NET library is connected well, the other one - API cannot be to the project at all.其中之一 - .NET 库连接良好,另一个 - API 根本无法连接到项目。 Whilst runtime I get a FileNotFound exception that's deatiled descrition虽然运行时我得到一个FileNotFound异常,这是 deatiled 描述

Could not load file or assembly "DynamicAudioNormalizerNET.dll" or one of its dependencies .无法加载文件或程序集“DynamicAudioNormalizerNET.dll”或其依赖项之一。

Also it is written in the documentation that文档中还写到

Microsoft.NET-based Application → Use the DynamicAudioNormalizerNET C++/CLI wrapper class, provided by the DynamicAudioNormalizerNET.dll assembly, requires DynamicAudioNormalizerAPI.dll at runtime.基于 Microsoft.NET 的应用程序 → 使用 DynamicAudioNormalizerNET C++/CLI 包装类,由 DynamicAudioNormalizerNET.dll 程序集提供,在运行时需要 DynamicAudioNormalizerAPI.dll。

It's dependency is of course "DynamicAudioNormalizerAPI.dll", but it is in the solution's folder as well as the NET.dll.它的依赖项当然是“DynamicAudioNormalizerAPI.dll”,但它位于解决方案的文件夹以及 NET.dll 中。 Also both libraries are added to the solution as files and their "Copy to output" feature is set to "Copy always".此外,这两个库都作为文件添加到解决方案中,并且它们的“复制到输出”功能设置为“始终复制”。 How can I link this two DLL or just make it run properly?如何链接这两个 DLL 或使其正常运行?

There are two probable reasons.有两个可能的原因。

  1. The first reason could be that DynamicAudioNormalizerAPI.dll is not placed together with DynamicAudioNormalizerNET.dll .第一个原因可能是DynamicAudioNormalizerAPI.dll没有与DynamicAudioNormalizerNET.dll放在一起。 Check Copy local refference property (in Solution Explorer) and Make sure that these two dlls comes together.检查Copy local引用属性(在解决方案资源管理器中)并确保这两个 dll 结合在一起。

  2. DynamicAudioNormalizerAPI.dll could have its own unresolved dependencies. DynamicAudioNormalizerAPI.dll可能有自己未解析的依赖项。 You can easily check this by opening .dll with special tool Dependency Walker .您可以通过使用特殊工具Dependency Walker打开.dll来轻松检查这一点。 It will show you if you also need some runtime or something.它会告诉你是否还需要一些runtime或其他东西。

It's dependency is of course "DynamicAudioNormalizerAPI.dll", but it is in the solution's folder as well它的依赖项当然是“DynamicAudioNormalizerAPI.dll”,但它也在解决方案的文件夹中

It needs to be in your projekt output directory (eg bin\\debug or bin\\release , where your .exe is), not the solution folder.它需要在您的项目输出目录中(例如bin\\debugbin\\release ,您的 .exe 所在的位置),而不是解决方案文件夹。

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

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