The recent use of the Common.logging Ilog interface as a log interface, while using its log4net adapter and log4net Recorder to record the system log, in the use of the process encountered a log4net version of the problem.
Install component packages in Project component management:
Pm> Install-package common.logging
pm> install-package Common.Logging.Log4Net "2.0. Version 1; dependency common.logging (≥2.0.0); Log4net (= 1.2.10) "
The project will reference the Log4net.dll version 1.2.10.0, in which case the run error occurred: {"Unable to create type" Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net ' "}
Upgrading the Log4net component to the latest version 1.2.13 failed, Install-package: Failed to update "Log4net 1.2.10" to "Log4net 2.0.3". The "Common.Logging.Log4Net" version that is compatible with "Log4net 2.0.3" is not found.
Remove the Common.Logging.Log4Net version and reinstall the following version
Pm> install-package Common.Logging.Log4Net1211 "2.2. version 0; common.logging (≥2.0.0); Log4net (≥1.2.11) "
The Log4net.dll version in the project is 1.2.11.0, run OK, upgrade log4net1.2.13 version, upgrade success, run OK;
Note the differences in the assembly file name in the profile
<common> <logging> <type = "Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net1211 ">
Version redirection
<assemblybindingxmlns="urn:schemas-microsoft-com:asm.v1"> <dependentassembly> <assemblyidentityname="common.logging" PublicKeyToken="af08829b84f0328e" Culture="Neutral"/> <BindingRedirectoldversion="0.0.0.0-2.2.0.0" newversion="2.2.0.0"/> </dependentassembly> <dependentassembly> <assemblyidentityname="log4net" PublicKeyToken="669E0DDF0BB1AA2A" Culture="Neutral"/> <BindingRedirectoldversion="0.0.0.0-1.2.13.0" newversion="1.2.13.0"/> </dependentassembly> </assemblybinding>
The reason is mainly due to the difference between log4net version 1.2.11 and 1.2.10 PublicKeyToken. You can view the public key using the VS tool sn–t component filename. dll.
Log4net (≥1.2.11) Public key is marked as 669E0DDF0BB1AA2A
Log4net (= 1.2.10) public key is marked as 1b44e1d426115821
http://www.nuget.org/packages/Log4Net/
http://www.nuget.org/packages/Common.Logging/
http://www.nuget.org/packages/Common.Logging.Log4Net1211/
http://www.nuget.org/packages/Common.Logging.Log4Net/
Http://developer.3l.nl/post/16463925249/log4net-1-2-11-dependency-hell