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

时间:2014-07-25 15:02:25

标签: nuget log4net common.logging

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

  

无法加载类型   'Common.Logging.Factory.AbstractCachingLoggerFactoryAdapter'来自   程序集'Common.Logging,Version = 2.2.0.0,Culture = neutral,   公钥= 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])

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

这不起作用。

2 个答案:

答案 0 :(得分:5)

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

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

答案 1 :(得分:0)

可能有助于某些人的另一种观点:

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

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

Install-Package Common.Logging.Log4Net1213

可以找到更多信息here