【问题标题】:c# dll binding to different versionc# dll绑定到不同版本
【发布时间】:2011-02-09 23:08:18
【问题描述】:

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

System.IO.FileLoadException:无法加载文件或程序集 'Iesi.Collections,版本=1.0.0.3,文化=中性, PublicKeyToken=aa95f207798dfdb4' 或其依赖项之一。这 定位程序集的清单定义与程序集不匹配 参考。 (来自 HRESULT 的异常:0x80131040)在 NHibernate.Cfg.Configuration.Reset() 在 NHibernate.Cfg.Configuration..ctor(SettingsFactory settingsFactory) 在 NHibernate.Cfg.Configuration..ctor() 在 Luther.Dao.Repositories.Session.NHibernateHelper..cctor() 在 NHibernateHelper.cs:第 18 行

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

【问题讨论】:

    标签: .net visual-studio-2008 nhibernate assemblies


    【解决方案1】:

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

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

    <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>
    

    【讨论】:

    • 你这家伙!说真的,虽然我已经有几个月没有靠近它了。上次打开还不错这些谜团之一。无论如何,谢谢 - 你可能为我节省了半天的时间。
    • @Chin 没问题。不久前我遇到了同样的问题-很高兴为别人省去了我的痛苦。 (c:
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-12-23
    • 2010-09-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-12-07
    • 2018-08-06
    相关资源
    最近更新 更多