0

I'm working with a project under .NET 4.5 & trying to use EL 5.0 Logging application block. The purpose is to load logging block schema from a separate file. Code which is shown below is executed successfully under .NET 4.0, but throws the FileLoadException exception on the line #2 of the code below (i.e. in new LogWriterFactory(..)):

        IConfigurationSource configSource = new FileConfigurationSource("logging.config");
        LogWriterFactory factory = new LogWriterFactory(configSource);
        LogWriter logWriter = factory.Create();

The exception is (sorry, it is translated into English by me):

Could not load file or assembly "Microsoft.Practices.Unity, Version=2.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" or one of its dependencies. Assembly manifest definition found doesn't correspond to the reference to the assembly. (Exception from HRESULT: 0x80131040)

Does anybody know if there is any chance to make it workable with .NET 4.5?

JSP
  • 457
  • 1
  • 7
  • 19
  • I haven't heard that Microsoft regards Enterprise Logging Block as deprecated. I thought about NLog, but it would be preferably to use Entlib Logging block because I've already used Entlib Unity in the same project & plan to use Exception handling block. – JSP Apr 25 '13 at 20:11
  • Apologies, I was familiar with an older version & didn't realize what 5.0 was. Sorry for the confusion. – Chris Apr 25 '13 at 20:13

1 Answers1

0

It appears that you are referencing a different version of Unity than what Enterprise Library is expecting. If you are using Unity 2.0.505.0, you should upgrade to the latest version of Enterprise Library 5.0 blocks from NuGet OR downgrade to Unity 2.0.414.0. You cannot use Unity 3.0.1304.0 with Enterprise Library 5.0, as far as I know.

Tim B
  • 2,340
  • 15
  • 21