Click here to Skip to main content
12,896,108 members (55,288 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# C#4.0
System.TypeInitializationException: The type initializer for 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory' threw an exception. ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0, Culture=neutral, PublicKeyToken=eca617d3969190ef' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory..cctor()
   --- End of inner exception stack trace ---
Posted 24-Sep-12 22:29pm
Updated 24-Sep-12 22:45pm
Mehdi Gholam334.7K
Richard MacCutchan 25-Sep-12 4:44am
The message tells what is missing, so you need to figure out why this assembly does not exist. Are you trying to run a .NET 4 program on a system which only has .NET 3.5 or earlier?
rotenda 25-Sep-12 4:58am
Im running .Net 4
Richard MacCutchan 25-Sep-12 5:11am
Well you still have some assembly or file (Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0) missing from your system so you need to investigate why you are trying to use it and why it cannot be found.
Richard MacCutchan 25-Sep-12 5:13am
According to MSDN this namespace is no longer maintained.
Umer Aziz Malik 25-Sep-12 5:20am
What exactly are you trying to do here?
rotenda 25-Sep-12 6:19am
After reading the link above i decided to remove it.
rotenda 25-Sep-12 6:20am
but now the error is:The type initializer for 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory' threw an exception
rotenda 25-Sep-12 6:20am
error: The type initializer for 'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory' threw an exception
Richard MacCutchan 25-Sep-12 11:36am
Go and look at the exception to see what it is telling you. Learning to use the information from exceptions is an essential part of development and debugging.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1


you must include 2 assemblies:

rotenda 25-Sep-12 8:57am
I have added the two assemblies, but getting error:
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory' threw an exception

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 25 Sep 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100