C# NUnit无法加载程序集

C# NUnit无法加载程序集,c#,winforms,nhibernate,nunit,C#,Winforms,Nhibernate,Nunit,我有一个winforms应用程序,它使用nhibernate、nhibernate.validator和其他库 当我运行独立的winforms应用程序时,一切都像一个符咒 但当我尝试使用Nunit运行测试用例时,它无法加载程序集: RManager.Tests.Model.AgentTest(TestFixtureSetUp): 设置:System.TypeInitializationException:O inicializador de tipo de'NHibernate.Validato

我有一个winforms应用程序,它使用nhibernate、nhibernate.validator和其他库

当我运行独立的winforms应用程序时,一切都像一个符咒

但当我尝试使用Nunit运行测试用例时,它无法加载程序集:

RManager.Tests.Model.AgentTest(TestFixtureSetUp): 设置:System.TypeInitializationException:O inicializador de tipo de'NHibernate.Validator.Event.NHibernateSharedEngineProvider'acionou uma exceçãO。 ---->System.IO.FileLoadException:无法加载文件或程序集“NHibernate,版本=3.3.1.4000,区域性=中性,PublicKeyToken=aa95f207798dfdb4”。(除HRESULT外:0x8013100)

奇怪的是,nhibernate几乎依赖于所有东西,但它们使用的是4.0.0.4000版

每个项目都有一个重定向:

<dependentAssembly>
    <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-4.0.0.4000" newVersion="4.0.0.4000" />
  </dependentAssembly>

我怎样才能知道出了什么问题?似乎只有在nunit下运行时才会出现问题


谢谢

尝试将旧版本设置为3.3.1.4000,这会将VS重定向到4.0.0.4000版本

<dependentAssembly>
    <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
    <bindingRedirect oldVersion="3.3.1.4000" newVersion="4.0.0.4000" />
  </dependentAssembly>


您看过这个问题吗
3.3.1.4000
是一个版本号,它已经包含在当前指定的范围内(
0.0.0.0-4.0.0.4000