Discussion:
I got this error, what does it mean ?
(too old to reply)
Andrew
2008-02-14 13:40:04 UTC
Permalink
Hi all,

Error Message:
" The type initializer for
'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory' threw an exception. "

Thanks
Andrew
Jon Skeet [C# MVP]
2008-02-14 13:45:18 UTC
Permalink
Post by Andrew
" The type initializer for
'Microsoft.Practices.EnterpriseLibrary.Common.
Configuration.ObjectBuilder.EnterpriseLibraryFactory'
threw an exception. "
Do you have access to the exception object rather than just the
message? That will probably tell you *which* exception was thrown by
the type initializer, which would explain what's wrong.
--
Jon Skeet - <***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Andrew
2008-02-14 17:43:01 UTC
Permalink
{System.TypeInitializationException: The type initializer for

'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory' threw an exception. --->

System.IO.FileNotFoundException: Could not load file or assembly
'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0,

Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system
cannot find the file specified.
File name: 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0,
Culture=neutral, PublicKeyToken=null'
at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory..cctor()

=== Pre-bind state information ===

LOG: This bind starts in default load context.
LOG: No application configuration file found.
LOG: Using machine configuration file from
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom,
partial, or location-based assembly bind).

file:///C:/Projects/ABC/WindowsTest1/bin/Debug/Microsoft.Practices.ObjectBuilder.DLL.
LOG: Attempting download of new URL

file:///C:/Projects/ABC/WindowsTest1/bin/Debug/Microsoft.Practices.ObjectBuilder/Microsoft.Practices.ObjectBuilder.D

LL.
LOG: Attempting download of new URL

file:///C:/Projects/ABC/WindowsTest1/bin/Debug/Microsoft.Practices.ObjectBuilder.EXE.
LOG: Attempting download of new URL

file:///C:/Projects/ABC/WindowsTest1/bin/Debug/Microsoft.Practices.ObjectBuilder/Microsoft.Practices.ObjectBuilder.E

XE.

--- End of inner exception stack trace ---
at

Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder.EnterpriseLibraryFactory.BuildUp[T](IConfigurationSo

urce configurationSource)
at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriterFactory.Create()
at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.get_Writer()
at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(LogEntry log)
at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(Object
message, ICollection`1 categories, Int32 priority,

Int32 eventId, TraceEventType severity, String title, IDictionary`2
properties)
at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(Object
message)
at MQLImport.MQLImport.CreateImportFile(String LinkName)
at DoncasterPathImport.DBNTConverter.Convert(String message) in
C:\Projects\ABC\Converter.cs:line 106}
Jon Skeet [C# MVP]
2008-02-14 18:14:54 UTC
Permalink
Post by Andrew
{System.TypeInitializationException: The type initializer for
'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.
ObjectBuilder.EnterpriseLibraryFactory' threw an exception. --->
System.IO.FileNotFoundException: Could not load file or assembly
'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system
cannot find the file specified.
File name: 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0,
Culture=neutral, PublicKeyToken=null'
at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.
ObjectBuilder.EnterpriseLibraryFactory..cctor()
And is Microsoft.Practices.ObjectBuilder.dll in the right place?
--
Jon Skeet - <***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Andrew
2008-02-14 19:19:01 UTC
Permalink
Thanks for replying.

I've got C# 6 projects in my 1 WinApp solution. They all link to the same
Microsoft.Practices.EnterpriseLibrary.Common.dll file , situated in the 1st
project's Debug folder.

Do I have to put the separate .dll files into their respective folders,
meaning in each one of my 6 project "Debug" folders ?

Thanks
Andrew
Post by Jon Skeet [C# MVP]
Post by Andrew
{System.TypeInitializationException: The type initializer for
'Microsoft.Practices.EnterpriseLibrary.Common.Configuration.
ObjectBuilder.EnterpriseLibraryFactory' threw an exception. --->
System.IO.FileNotFoundException: Could not load file or assembly
'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0,
Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system
cannot find the file specified.
File name: 'Microsoft.Practices.ObjectBuilder, Version=1.0.51205.0,
Culture=neutral, PublicKeyToken=null'
at
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.
ObjectBuilder.EnterpriseLibraryFactory..cctor()
And is Microsoft.Practices.ObjectBuilder.dll in the right place?
--
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Jon Skeet [C# MVP]
2008-02-14 19:29:44 UTC
Permalink
Post by Andrew
I've got C# 6 projects in my 1 WinApp solution. They all link to the same
Microsoft.Practices.EnterpriseLibrary.Common.dll file , situated in the 1st
project's Debug folder.
Do I have to put the separate .dll files into their respective folders,
meaning in each one of my 6 project "Debug" folders ?
No, but it looks like you should also add a reference to
Microsoft.Practices.ObjectBuilder.dll.
--
Jon Skeet - <***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Andrew
2008-02-15 09:04:01 UTC
Permalink
Hi,
Thanks for your reply.

I do have a dll file named :
Microsoft.Practices.EnterpriseLibrary.Common.dll;

And which my code reads :
using Microsoft.Practices.EnterpriseLibrary.Common;
using
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;

This means that I have already referenced the required .dll file ?

Thanks
Andrew
Post by Jon Skeet [C# MVP]
Post by Andrew
I've got C# 6 projects in my 1 WinApp solution. They all link to the same
Microsoft.Practices.EnterpriseLibrary.Common.dll file , situated in the 1st
project's Debug folder.
Do I have to put the separate .dll files into their respective folders,
meaning in each one of my 6 project "Debug" folders ?
No, but it looks like you should also add a reference to
Microsoft.Practices.ObjectBuilder.dll.
--
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Jon Skeet [C# MVP]
2008-02-15 09:26:25 UTC
Permalink
Post by Andrew
This means that I have already referenced the required .dll file ?
<snip>

In addition to my previous reply, please see
https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1129935&SiteID=1

Jon
Andrew
2008-02-15 10:50:02 UTC
Permalink
I've installed the "Microsoft Enterprise Library January 2006" edition and
I've found the ObjectBuider.dll there.
Finally... onto the next bug...

Thanks

regards,
Andrew
Post by Jon Skeet [C# MVP]
Post by Andrew
This means that I have already referenced the required .dll file ?
<snip>
In addition to my previous reply, please see
https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1129935&SiteID=1
Jon
Andrew
2008-02-15 10:51:01 UTC
Permalink
I've installed the "Microsoft Enterprise Library January 2006" edition and
I've found the ObjectBuider.dll there.
Finally... onto the next bug...

Thanks

regards,
Andrew
Post by Jon Skeet [C# MVP]
Post by Andrew
This means that I have already referenced the required .dll file ?
<snip>
In addition to my previous reply, please see
https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1129935&SiteID=1
Jon
Jon Skeet [C# MVP]
2008-02-15 09:24:21 UTC
Permalink
Post by Andrew
Microsoft.Practices.EnterpriseLibrary.Common.dll;
using Microsoft.Practices.EnterpriseLibrary.Common;
using
Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder;
This means that I have already referenced the required .dll file ?
No. Look at the error message - it's looking for
Microsoft.Practices.ObjectBuilder.dll. I don't know anything about the
library, but apparently it needs that DLL...

Note that using directives talk about namespaces, not assemblies - the
using directives you have in your file don't add references to
assemblies, so they're effectively irrelevant. It's the project
references which matter.
--
Jon Skeet - <***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
Loading...