log4net is part of the Apache Logging Services project at the Apache Software Foundation. The Logging Services project is intended to provide cross-language logging services for purposes of application debugging and auditing.
Could not load file or assembly 'log4net, Version=1.2.0.30714, Culture=neutral, PublicKeyToken=b32731d11ce58905' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
From what I understand, this means that the actual file located (that is, log4net.dll in my bin directory) does not match the version expected based on some assembly configuration. The problem I'm having is that I cannot locate where this file is being referenced.
We had this problem also when we moved to VS 2010 and .NET 4.0, we don't use log4net at all, but I suspect something else we use does (maybe Crystal Reports?) and I also suspect there is a dll we use that is a 32-bit dll as well because when I change the "Enable 32-Bit Applications" option under the advanced settings for the Application Pool in IIS to "True" everything worked again.
You need to control the references in projects as well - the references are compiled into the assembly itself and will attempt a loading. My guess is, you have an outdated reference to the log4net assembly but are using the latest version.
Ultimately, I was not able to figure out which of the third party DLLs was actually referencing log4net. I did notice after building though that a log4net.dll was copied into my "bin" directory and I right clicked on it and figured out it was related to Apache Foundation -
Same error here, here is how we fixed: Downloading latest .Net 4.0 log4net.dll from Apache and replacing the version in the bin folder worked for me. You should add the reference to your project to make it permanent. Here is the link: Apache
The dependency checker can be used to see if there are unexpected modules used by the log4net assembly. And the Reflector utility shows all kinds of useful information about assemblies (including versions, referenced assemblies, not to mention disassembled code).
I also ran into this problem and the reason it was happening was that the project, for some reason, was pulling the log4net from the GAC, so it is quite possible that the version in the GAC does not match the version referenced in your project
Apache log4net 2.0.8 fixes a LockRecursionException that could happen inside the FileAppender under certain circumstances. It also adds support for LogicalThreadContext to the .NET Standard build based on AsyncLocal rather than CallContext.
Apache log4net 2.0.7 fixes a glitch in nuget packaging and is otherwise identical to 2.0.6 (apart from the copyright year and assembly version). If you are not using the nuget package there is no reason to upgrade.
The Apache log4net team is now responsible for the nuget package, we've changed the version number of this release to align the version numbers. Release 2.0.6 is supposed to be compatible with 1.2.15.
Starting with 2.0.6 .NET Core - or more precisely .NET Standard 1.3 - has become a supported platform. Please note that several features of log4net are not available when using the .NET Core version, see framework support for details.
In the log4net.Config namespace the DOMConfigurator, DOMConfiguratorAttribute, DomainAttribute, and AliasDomainAttribute have been marked as obsolete. These types are still available and functional in this release.
A new log4net assembly is built that targets all CLI 1.0 compatible runtimes. This build is essentially a common subset of the Mono 1.0 and .NET 1.0 builds. It is built using the MS .NET 1.0 compiler and libraries but does not use any platform specific APIs.
The above config defines a custom pattern called myConverter which is bound to the TestApp.MyPatternConverter, TestApp type. This type must extend the log4net.Util.PatternConverter base class. The custom pattern can then be used in the pattern string.
To resolve cross platform and cross version issues we have changed the log4net assembly to use a common name for all frameworks. The assembly friendly name is now log4net. The builds for each framework can now be differentiated by the assembly title. This includes the name of the framework that the assembly was built on.
If you are configuring log4net programmatically (i.e. not using one of the built-in configurators) you must set the ILoggerRepository.Configured property to true once you have configured the repository.
The Hierarchy specific data schema and implementation could be has now been moved to the log4net.Repository.Hierarchy namespace. The bootstrap code for these configurators remains in the log4net.Config namespace.
The LogManager supports multiple logging domains. The LogManager uses an instance of the IRepositorySelector class to map from domains to ILoggerRepository instances. The default implementation is to have a separate ILoggerRepository for each domain. When a call is made to the static methods on LogManager the domain can be specified (as a string) or the domain can be inferred automatically from the calling assembly. The default behavior is for each assembly loaded into the process to have its own domain and ILoggerRepository. These can each be configured separately. This allows standalone assemblies to use log4net without conflicting with other modules in the process. The domain for the assembly is configured using metadata attributes defined on the assembly.
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified." This error is located in the web.config file.
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.
My hypothesis is that if I install the requested version of log4net.dll, my problems will be solved. But I have no clue which file that it, or where to find it. I've checked the obvious by downloading log4net 1.2.10 and trying out every dll in the download.
The Fix that worked for us in 64-bit was to get the latest log4net.dll which actually has a new PublicKeyToken, replace the log4net.dll in your 3rd party bin folder, AND change all of the log4net.dll references to look like so:
If your machine is 64bit and you install Crystal Report 32bit version, then this error will haunt you like anything. In this case, all the required assemblies are properly registered in GAC but still, it says "unable to load log4net assembly..."The reason for this error is that you are trying to execute a 32bit application on a 64bit machine.
To find a reference Microsoft Visual Studio has a Browser feature. You can use that to get the dll. To find the dll you can click on your references in your project and the click the reference that you want to find. In this case Log4Net. It will show a list of dependencies, the other log4net should be near the selected Log4Net, and there should be a some text showing the location of the current selected dll reference. This is where you will find the reference.
2) It will take you to Manage NUGet Packages then select "Online" on the left pane then search for "log4net" it is ported from apache log4j then install it. Done you will find it installed under References in your project
In short, [log4net.Layout.SerializedLayout, log4net.Ext.Json] is requesting log4net version 2.0.9.0, while [Logzio.DotNet.Log4net.LogzioAppender, Logzio.DotNet.Log4net] is requesting log4net version 2.0.12.0
Did you add the 1.2.11.0 log4net as a reference in your project and recompile it afterwards? We've been doing this on projects where we have been using an older version of the log4net.dll file, which worked fine.
No, I added Umbraco to my project using the package manager console. So I guess it's the binary distribution, and my feeble attempts at adding references to different versions of log4net have not been compiled into the project...
Was having the same problem with Log4Net and finally found the cause. In my project downloaded Log4Net from the Apache site ( ) and copied the log4Net.DLL in folder log4net-1.2.11-bin-newkey\log4net-1.2.11\bin\net\4.0\release. This DLL is the same version 1.2.11.0 but noticed has different file size to the one that comes with Umbraco 6 installation.
I'm experiencing the same issue. I have a domain project which relies on Castle Windsor to inject the log4net facility into my code and this relies on log4net 1.2.10 but Umbraco is using, what seems to be a patched version of 1.2.11.
Redirecting all assemblies to 1.2.11 from Umbraco installation but it won't work as the patched version has a null public key token
Forking castle core log4net integration to use the umbraco patched log4net assembly which won't build as it doesnt have a Strong Name
Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.IO.FileNotFoundException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.
and I have checked GAC assembly I didn't find log4net.dll and even in my system I have search all and tried various things like changing runtime version and uploading lo4net dll from apache but no luck.
35fe9a5643