【问题标题】:Loading Assemby failed with FileNotFoundException - Fusion says all ok加载程序集失败并出现 FileNotFoundException - Fusion 表示一切正常
【发布时间】:2023-03-15 03:25:02
【问题描述】:

我有一个包含 C++/CLI 代码的程序集,我想在我的单元测试项目中引用它。 MSTest 说:

Test method  Grafik.Implementation.Tests.MappingHelperTests.GetMappedFeatures_OneMappedFeature_OneFeatureReturned threw exception: 
System.IO.FileNotFoundException: Die Datei oder Assembly "Graphic.Interface.Managed.dll" oder eine Abhängigkeit davon wurde nicht gefunden. Das angegebene Modul wurde nicht gefunden.

我激活了 Fusion Assembly-Binder 协议。这说明绑定没问题:

LOG: Die Bindung war erfolgreich. Assembly wird zurückgegeben von C:\xyz\Grafik.Tests\bin\x86\Debug\Graphic.Interface.Managed.dll.
LOG: Die Assembly wird im default-Load-Kontext geladen.

有人知道这里出了什么问题吗?平台是x86。 提前致谢!

【问题讨论】:

    标签: .net .net-assembly filenotfoundexception fusion


    【解决方案1】:

    很可能,您的程序集链接到在搜索路径中找不到的某个 DLL。如果 C++/CLI 代码包含“附加依赖项”,则必须将相应的 DLL 复制到单元测试项目的输出路径中,该路径使用 C++/CLI 代码引用程序集。

    查看单元测试项目引用的 C++/CLI 项目的项目属性。转到“链接器/输入”属性。如果“附加依赖项”下列出了 LIB 文件,请确保相应的 DLL 存在于单元测试项目的输出路径中。

    不幸的是,如果无法加载从那里引用的 C++ 库,则融合程序集绑定器协议仍然报告程序集加载成功。

    【讨论】:

      猜你喜欢
      • 2014-05-21
      • 1970-01-01
      • 2019-11-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-29
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多