Nuget 无法加载类型';Common.Logging.Factory.AbstractCachingLoggerFactoryAdapter';

Nuget 无法加载类型';Common.Logging.Factory.AbstractCachingLoggerFactoryAdapter';,nuget,log4net,common.logging,Nuget,Log4net,Common.logging,我刚刚更新了Common.Logging.Log4Net的nuget包。从那以后,我一直遇到以下错误: 无法加载类型 “Common.Logging.Factory.AbstractCachingLoggerFactoryAdapter”来自 程序集'Common.Logging,版本=2.2.0.0,区域性=neutral, PublicKeyToken=af08829b84f0328e' 以下是链接到Common.Logging的每个nuget软件包的列表以及版本: Common.Logg

我刚刚更新了
Common.Logging.Log4Net
的nuget包。从那以后,我一直遇到以下错误:

无法加载类型 “Common.Logging.Factory.AbstractCachingLoggerFactoryAdapter”来自 程序集'Common.Logging,版本=2.2.0.0,区域性=neutral, PublicKeyToken=af08829b84f0328e'

以下是链接到
Common.Logging
的每个nuget软件包的列表以及版本:

  • Common.Logging-2.2.0
  • Common.Logging.Core-2.2.0
  • Common.Logging.Log4Net-2.0.1
在我的web.config中,我有以下内容:

<configuration>
  <configSections>
   <sectionGroup name="common">
      <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
    </sectionGroup>
  </configSections>

  //...//

  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="Common.Logging" publicKeyToken="af08829b84f0328e" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-2.2.0.0" newVersion="2.2.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>

  //...//

  <common>
    <logging>
      <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net">
        <arg key="configType" value="FILE-WATCH" />
        <arg key="configFile" value="~/log4net.config" />
      </factoryAdapter>
    </logging>
  </common>
</configuration>

//...//
//...//
如何解决此问题?

我尝试过改变:

<factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4net">

到(添加了Common.Logging.Log4net.dll[201]的版本)



这是行不通的。

所以我找到了我问题的答案,并想与任何遇到同样问题的人分享答案

它看起来介于
Common.Logging 2.1.2
Common.Logging 2.2.0
之间。开发人员进行了更改,创建了一个新库
Common.Logging.Core
。根据Common.Logging development(GitHub)站点,尚未更新
Common.Logging.Log4Net
包以支持新的更改

  • Ryan Wentzel在评论中提到,他需要为他的BaseSpace项目回滚到2.1.2版本的
    Common.Logging
  • TypeLoadException解释为记录的问题:

    • 另一种可能对某些人有所帮助的观点:

      从Common.Logging 3.0开始,开发人员改变了他们处理版本依赖关系的方式,例如,不再支持程序集Common.Logging.Log4Net,每个框架现在都需要特定于版本的引用。因此,对于Common.Logging.Log4Net,本文的最新版本将是Common.Logging.Log4Net1213

      使用nuget,您可以通过以下方式获得:

      Install-Package Common.Logging.Log4Net1213
      

      可以找到更多信息。

      请注意,在调用
      LogManager.GetCurrentClassLogger()时引发了此错误。
      Install-Package Common.Logging.Log4Net1213