Getting log4net Errors When Attempting to Browse Sitecore Pages

In this article

Description

The log4net.dll file in the <SITECORE_INSTANCE_ROOT>\website\bin folder was changed and you’re now seeing errors like the following when attempting to browse your Sitecore pages:

Could not load file or assembly ‘log4net, Version=1.2.11.0, culture=neutral, PublicKeyToken=669e0ddf0bb1aa2a or one of its dependencies. The located assembly’s manifest definition doesn’t match the assembly reference…

Explanation

Coveo for Sitecore uses its own version of log4net.dll. This custom version of log4net.dll is 1.2.11.0.

The Coveo for Sitecore version of the log4net.dll needs to be in the bin folder of your website in order for it to work properly.

Note

Whenever you’re installing a Coveo for Sitecore package, it will automatically overwrite any version of log4net.dll in <SITECORE_INSTANCE_ROOT>\website\bin.

Resolution

If you’re planning on using a log4net.dll file other than the Coveo for Sitecore custom version, you need to install that dll in a folder other than bin.

Therefore, you need to create a separate folder for your version of log4net.dll and explicitly tell Sitecore where to get it:

  1. In the <SITECORE_INSTANCE_ROOT>\website directory, create a folder named log4netCustom. The path to this folder will be <SITECORE_INSTANCE_ROOT>\website\log4netCustom.

  2. Move your log4net.dll (1.2.XX.0) file into the log4netCustom folder.

  3. Open the Sitecore web.config file.

  4. Locate the assemblyBinding element.

  5. Insert the following XML snippet inside the assemblyBinding element.

    <dependentAssembly>
      <assemblyIdentity name="log4net" publicKeyToken="669e0ddf0bb1aa2a" />
      <codeBase version="1.2.XX.0" href="log4netCustom\log4net.dll" />
    </dependentAssembly>