.net - c# dll绑定(bind)到不同版本

标签 .net visual-studio-2008 nhibernate assemblies

我刚刚重新启动了一个使用 NHibernate 的项目。我上次使用该项目时运行良好,但现在出现以下错误。

System.IO.FileLoadException: Could not load file or assembly 'Iesi.Collections, Version=1.0.0.3, Culture=neutral, PublicKeyToken=aa95f207798dfdb4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at NHibernate.Cfg.Configuration.Reset() at NHibernate.Cfg.Configuration..ctor(SettingsFactory settingsFactory) at NHibernate.Cfg.Configuration..ctor() at Luther.Dao.Repositories.Session.NHibernateHelper..cctor() in NHibernateHelper.cs: line 18

我注意到当前对 iesi.dll 的引用位于 1.0.1.0。 让它重新启动并运行的最佳方法是什么?尝试找到合适版本的dll或整理 list 文件?

最佳答案

自上次运行此应用程序以来,您是否更新了项目中的某个程序集? NHibernate 似乎是针对版本 1.0.0.3 构建的,而您当前拥有的是 1.0.1.0。

您应该能够使用 BindingRedirect App.config(或 web.config,视情况而定)中的元素指示 .Net Framework 满足不同版本的依赖关系。类似的东西

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Iesi.Collections" 
                          publicKeyToken="aa95f207798dfdb4"
                          culture="neutral" />
          <bindingRedirect oldVersion="1.0.0.3"
                           newVersion="1.0.1.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

关于.net - c# dll绑定(bind)到不同版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2672253/

相关文章:

visual-studio-2008 - 从 VC6 -> vc2005,2008 移植真的值得吗?

NHibernate,具有相同标识符值的另一个对象已与该 session 关联

c# - NHibernate Queryable 不允许进行字符串比较

.net - 将用户添加到 Active Directory 中的安全组

c# - 如何使用结构图获取泛型类的所有实例

c# - 如何将 XmlElement 的 child 相互转换?

c# - 在 VS 08 和 C# 中获得生产力的最快方法

c# - 基于条件的linq语法调用方法

sql - 为什么我右键单击任务时没有显示 "execute task"?

.net - 将 NHibernate SQLite 应用程序升级到 .Net 4.0 时出现问题