ExceptionHandling - located assembly's manifest definition does not match the assembly reference

Topics: Exception Handling Application Block
Mar 21, 2012 at 8:10 PM

I'm going through the Hands-On Labs for Microsoft Enterprise Library 5.0

I had installed Microsoft Enterprise Library, and then I downloaded entlibcontrib.   I copied its entire entlibcontrib-5.0.505.0-2011-10-29-bin\bin into Program Files (x86)\Microsoft Enterprise Library 5.0\Bin and so now I have :

Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll 5.0.505.0

Microsoft.Practices.EnterpriseLibrary.Logging.dll 5.0.505.0

In the Documents\Microsoft Enterprise Library 5.0 - Hands On Labs\CS\Exception Handling\exercises\ex01\end\PuzzlerUI\AppConfig there is:

section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true"

section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true"

 I changed the Version to 5.0.505.0.

This PuzzlerUI lab has us start without debugging.  (So I had found this similar discussion about changing that PublicKeyToken to null.  I tried that too).

Now, though, I cannot get past the Visual Studio warning:

Warning 62 Found conflicts between different versions of the same dependent assembly. PuzzlerUI

and the run-time error:

An error occurred creating the configuration section handler for exceptionHandling: Could not load file or assembly 'Microsoft.Practices.EnterpriseLibrary.ExceptionHandling,Version=5.0.414.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)


Is it possible that the App.config within Microsoft Enterprise Library 5.0 - Hands On Labs\CS\Exception Handling\exercises\ex01\end\PuzzlerUI\ is wrong?



Mar 21, 2012 at 8:22 PM

My version works fine.

The Hands on Labs uses version 5.0.414.0.  The Enterprise Library assemblies are supplied with the Hands on Labs in the Enterprise Library 5.0 - Hands On Labs\Lib directory which is what the projects should be referencing.

You can change to 5.0.505.0 by modifying all configuration files to use that version and then changing the references to point to the 5.0.505.0 assemblies.   

Randy Levy
Enterprise Library support engineer

Mar 22, 2012 at 6:30 AM

Just to clarify, you can perform the Hands on Labs using 5.0.505.0 but just that the "end" version with the completed results is based on 5.0.414.0.

Randy Levy
Enterprise Library support engineer

Mar 22, 2012 at 2:53 PM
Edited Mar 22, 2012 at 2:56 PM

I changed the CS\Exception Handling\exercises\ex01\begin\PuzzlerUI\App.config's references to Version=5.0.505.0 and in the Visual Studio project, I deleted the four Microsoft.Practices.* DLLs and re-added them and cleaned and rebuilt.

I didn't have problems with the Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.505.0 and Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.505.0 in a different project, but am having problems with this Microsoft.Practices.EnterpriseLibrary.ExceptionHandling and Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.

Have you had success doing the exception handling hands on exercises with the 5.0.505.0 versions of the Microsoft.Practices DLLs ?

Mar 22, 2012 at 5:32 PM

I don't get it.

In the PuzzlerUI's app.config I changed, near the top of the files, the two sections from 5.0.414.0 to 5.0.505.0 and also deleted 'References' and re-added the reference DLLs.  Even in Visual Studio 2010 'Properties' we can see that the Microsoft.Practices.EnterpriseLibrary.ExceptionHandling is Version 5.0.505.0.  I rebuild-all.  I see in the compile output:

------ Rebuild All started: Project: PuzzlerUI, Configuration: Release Any CPU ------ Consider app.config remapping of assembly "Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.0.414.0" [] to Version "5.0.505.0" [C:\Program Files (x86)\Microsoft Enterprise Library 5.0\Bin\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll] to solve conflict and get rid of warning. Consider app.config remapping of assembly "Microsoft.Practices.EnterpriseLibrary.Common, Culture=neutral, PublicKeyToken=31bf3856ad364e35" from Version "5.0.414.0" [] to Version "5.0.505.0" [C:\Program Files (x86)\Microsoft Enterprise Library 5.0\Bin\Microsoft.Practices.EnterpriseLibrary.Common.dll] to solve conflict and get rid of warning. C:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets(1360,9): warning MSB3247: Found conflicts between different versions of the same dependent assembly. PuzzlerUI -> C:\Users\me\Documents\Microsoft Enterprise Library 5.0 - Hands On Labs\CS\Exception Handling\exercises\ex01\begin\PuzzlerUI\bin\Release\PuzzlerUI.exe

I don't see how there's any way to fix this....

Mar 22, 2012 at 5:47 PM

I followed this:

Warning: Found conflicts between different versions of the same dependent assembly and it placed into app.config (near bottom):

		<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
				<assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
				<bindingRedirect oldVersion="" newVersion="5.0.505.0"/>
				<assemblyIdentity name="Microsoft.Practices.EnterpriseLibrary.Common" publicKeyToken="31BF3856AD364E35" culture="neutral"/>
				<bindingRedirect oldVersion="" newVersion="5.0.505.0"/>
I ran Puzzler and got slightly different error. I changed those two to 5.0.414.0 and still problems ...

Mar 23, 2012 at 2:47 AM

Hi bdwill,

if you look at the labs .csproj files with a text editor, you'll see that the projects reference the EntLib assemblies from the labs "Lib" subfolder. Therefore, you should copy the 5.0.505 assemblies in this folder instead of replacing the assemblies in the Program Files (x86)\Microsoft Enterprise Library 5.0\Bin folder.

Let us know if that worked.



Mar 23, 2012 at 3:30 PM
Edited Mar 23, 2012 at 3:37 PM

Yes, yesterday I edited the PuzzlerUI.csproj file changing it to:


    <Reference Include="Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <HintPath>Third Party\Microsoft.Practices.EnterpriseLibrary.Common.dll
    <Reference Include="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <HintPath>Third Party\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
    <Reference Include="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <HintPath>Third Party\Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll
    <Reference Include="Microsoft.Practices.ServiceLocation, Version=, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
      <HintPath>Third Party\Microsoft.Practices.ServiceLocation.dll


and I copied into the CS\Exception Handling\exercises\ex01\begin\PuzzlerUI\Third Party dir:

The Microsoft.Practices.ServiceLocation.dll is version and dated 10/4/2011. The Microsoft.Practices.EnterpriseLibrary.Common.dll and Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll are dated 10/4/2011 and are version 5.0.505.0. The Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll is dated 4/6/2010 and versioned 5.0.414.0. In the entlibcontrib-5.0.505.0-2011-10-29-bin\bin dir, there is a Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll (10/4/2011 5.0.505.0) but no Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll

Still no joy.

Nov 21, 2012 at 11:36 AM
Edited Nov 21, 2012 at 2:13 PM

I had a similar problem and discovered (adding the file version to the columns showed in Windows Explorer) that I had more DLLs in my bin\Release folder than I had referenced, and they were of the wrong version (5.0.414.0). They were for application blocks I was not using, but they caused the problem when building the Unity container.

I cleaned the solution and deleted manually every assembly before compiling again, and then only the DLLs I had referenced showed up again and the problem disappeared.

So, check with Windows Explorer that you only have 5.0.505.0 versions in your bin folder.