在将 EmguCV 4.7.0 库文件替换为 4.6.0 后,我在 C# Windows 窗体应用程序中运行时遇到此错误。我降级是因为 4.7.0 还不支持 CUDA。
我还没有启用 CUDA 或下载驱动程序,我只是替换了 EMGUCV DLL 文件。默认情况下它应该可以在没有 CUDA 的情况下工作,但是它在
Application.Run(new MainForm())
上崩溃了
有错误:
FileLoadException: Could not load file or assembly 'Emgu.CV, Version=4.6.0.5131, Culture=neutral, PublicKeyToken=7281126722ab4438' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
我确保新的 DLL(Emgu.Cv.dll 和 cvextern.dll)被复制到 x64/Debug 文件夹,在我检查的库文件下
Copy if newer
并确保它们在运行时位于 Debug 文件夹中
另外在参考文献中我可以看到 EmguCV Dll 的版本 4.6.0
为了让它发挥作用,我还忘记改变什么?我是否缺少 CUDA 版本所需的一些非 Cuda 版本不需要的其他 DLL?我确保我使用的是 4.6.0 Cuda 版本中的 cvextern.dll
我确保尝试清理和重建,但没有成功
我也没有使用 NuGet 包管理器,只是手动加载 dll。
显然我仍然需要手动将
app.config
文件更改为
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Emgu.CV" publicKeyToken="7281126722ab4438" culture="neutral" />
<codeBase version="4.6.0.5131" href="path-to-new-Emgu.CV-assembly.dll" />
</dependentAssembly>
</assemblyBinding>
</runtime>
谢谢chatgpt