【问题标题】:NUnit and NHibernate, FileLoadExceptionNUnit 和 NHibernate,FileLoadException
【发布时间】:2012-08-24 18:24:13
【问题描述】:

我尝试使用 NUnit 为简单的 NHibernate 映射和 InMemory SqLite 数据库进行一些单元测试。 SqLite 在我的单元测试项目中被引用,NHibernate 在 Nuget 的同一版本中被两个项目引用。

我的测试看起来像

[Test]
    public void AddDocumentTest()
    {
        var document = new Repository<Document>(Session);
        document.Add(new Document { FileName = "Blubb", Id = Guid.NewGuid(), Title = "Dummy Title" });
        // here comes the error            
        var i = document.All().Count();
    }

当我在文档类上调用一些 Linq 方法时,我得到了

System.IO.FileLoadException : Die Datei oder Assembly "NHibernate, Version=2.1.2.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4" oder eine Abhängigkeit davon wurde nicht gefunden。 Die gefundene Manifestdefinition der Assembly stimmt nicht mit dem Assemblyverweis überein。 (Ausnahme von HRESULT: 0x80131040)

抱歉,我只有德语版本,但我认为发生了什么很清楚。 为什么他要寻找一个完全不同的 NHibernate 版本? (我的版本是3.3.1.4000)

【问题讨论】:

  • 不确定它是否会有所帮助,但here 是对FileLoadException 问题的回答,其中两个具有不同版本号的程序集被配置为一起工作。
  • 谢谢,我现在发现了问题。

标签: c# nhibernate nunit


【解决方案1】:

问题是我还引用了 NHibernate2Linq 项目,该项目试图在旧版本中获取 Nhibernate。

【讨论】:

    猜你喜欢
    • 2011-11-07
    • 2018-02-21
    • 1970-01-01
    • 1970-01-01
    • 2010-12-13
    • 1970-01-01
    • 1970-01-01
    • 2014-10-01
    • 1970-01-01
    相关资源
    最近更新 更多