An error occurred creating the configuration section handler for loggingConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its depen

Apr 24, 2013 at 8:42 AM

We implemented a logger using the enterprise library. For some reason on most computers the new integration was successful. However, on one computer we keep getting the error mentioned: "An error occurred creating the configuration section handler for loggingConfiguration: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)"

Background: The sln includes several projects which one of them contains the implementation of our Logger.
The Windows forms projects which we are trying to run contains a app.config file with the following entries:
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />

<loggingConfiguration name="" tracingEnabled="true" defaultCategory="EventLogLogger">
  <add name="EventLogLogger" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      source="Enterprise Library Logging" formatter="Text Formatter"
      log="" machineName="." traceOutputOptions="None" />
  <add name="FileLogger" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      footer="" formatter="Text Formatter" header="" rollSizeKB="5120"
      maxArchivedFiles="10" />
  <add name="EmailLogger" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.EmailTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.EmailTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      toAddress="" fromAddress=""
      subjectLineStarter="PRE" subjectLineEnder="SUF" formatter="Text Formatter" />
  <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
      name="Text Formatter" />
  <add switchValue="All" name="EventLogLogger">
      <add name="EventLogLogger" />
  <add switchValue="All" name="FileLogger">
      <add name="FileLogger" />
  <add switchValue="All" name="EmailLogger">
      <add name="EmailLogger" />
  <allEvents switchValue="All" name="All Events" />
  <notProcessed switchValue="All" name="Unprocessed Category">
      <add name="FileLogger" />
  <errors switchValue="All" name="Logging Errors &amp; Warnings">
      <add name="FileLogger" />

I've already tried to uninstall vs2012 and re install it.
I installed the VS2012 update 2 and no updates are necessary.
Windows 7
Microsoft Visual Studio Professional 2012 :
Version 11.0.60315.01 Update 2
Microsoft .NET Framework
Version 4.5.50709

Installed Version: Professional

LightSwitch for Visual Studio 2012 04938-004-0033001-02162
Microsoft LightSwitch for Visual Studio 2012

Office Developer Tools 04938-004-0033001-02162
Microsoft Office Developer Tools

Team Explorer for Visual Studio 2012 04938-004-0033001-02162
Microsoft Team Explorer for Visual Studio 2012

Visual Basic 2012 04938-004-0033001-02162
Microsoft Visual Basic 2012

Visual C# 2012 04938-004-0033001-02162
Microsoft Visual C# 2012

Visual C++ 2012 04938-004-0033001-02162
Microsoft Visual C++ 2012

Visual F# 2012 04938-004-0033001-02162
Microsoft Visual F# 2012

Visual Studio 2012 Code Analysis Spell Checker 04938-004-0033001-02162
Microsoft® Visual Studio® 2012 Code Analysis Spell Checker

Portions of International CorrectSpell™ spelling correction system © 1993 by Lernout & Hauspie Speech Products N.V. All rights reserved.

The American Heritage® Dictionary of the English Language, Third Edition Copyright © 1992 Houghton Mifflin Company. Electronic version licensed from Lernout & Hauspie Speech Products N.V. All rights reserved.

Visual Studio 2012 SharePoint Developer Tools 04938-004-0033001-02162
Microsoft Visual Studio 2012 SharePoint Developer Tools

.NET Reflector Visual Studio Extension
Integrates .NET Reflector into Visual Studio to allow you to seamlessly debug into third-party code and assemblies, even if you don't have the source code for them.

Visit for more information.

Copyright (c) 2009-2012 Red Gate Software Inc.

AlignAssignments 1.0
Command for aligning assignments.

AutoBraceComplete 1.0
auto brace complete

Color Theme Designer 1.0
Designer for creating new color themes

CustomDocWell 1.0
Provides configurable behavior for the document well in Visual Studio 2012.

JetBrains ReSharper 7.1.3 C# Edition build 7.1.3000.1964 on 2013-03-25T09:59:04
JetBrains ReSharper 7.1.3 package for Microsoft Visual Studio. For more information about ReSharper, visit Copyright © 2003–2013 JetBrains, Inc.

Microsoft Enterprise Library Configuration Console 1.0
Launcher for the Microsoft Enterprise Library Configuration Console.

NuGet Package Manager 2.2.40116.9051
NuGet Package Manager in Visual Studio. For more information about NuGet, visit

OptionsPageImpl 1.0
Information about my package

PowerCommands for Visual Studio 2010 1.0
A set of power commands for Visual Studio 2010

PreEmptive Analytics Visualizer 1.0
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

Quick Launch Tasks 1.0
Microsoft Quick LaunchTasks package adds accessibility and settings tasks to the Quick Launch tool.

Red Gate SQL Connect
Simple database development within Visual Studio

VSCommands11 11.0
VSCommands 11

Web Developer Tools 1.2.40308.0
Microsoft Web Developer Tools contains the following components:
Page Inspector: Tool that offers an efficient way to decompose Web Applications and diagnose front-end issues.
Web Publishing: Extensions required for Web Publishing for both hosted servers as well as on premises.
Web Form Templates: Includes the default templates for Web Form Applications.
Editor Extensions: Includes HTML, CSS, and JS editor extensions that greatly enhance the development experience.
I'd appreciate any help you could offer.

Apr 24, 2013 at 9:43 AM
By the way


Apr 25, 2013 at 4:36 AM
The exception occurs when the assembly information found at runtime does not match what was expected by the calling assembly (e.g. version or public key token does not match).

Since it is only occurring on one machine, I would suspect that there may be another version of Enterprise Library deployed on that machine (e.g. in the GAC). The quickest way to troubleshoot what is happening is to use the Assembly Binding Log Viewer to see the specific binding information. That should tell you what assembly is being located and you should be able to see how it differs from the expected version.

Randy Levy
Enterprise Library support engineer
Support How-to