Will Enterprise Library 4.1 run in .NET 4.0?

Topics: General discussion
Apr 4, 2011 at 4:35 PM
Edited Apr 4, 2011 at 4:38 PM

I am moving from Visual Studio 2008 .NET 3.5 to Visual Studio .NET 4.0 but after Visual Studio 2010 converted the solution; I had build errors:

  • Removed all references to Oracle code.
  • Replaced [SecurityPermission] with [SecurityCritical] on all overrides of GetObjectData()'s.
  • Updated Resources.resx
    • From: System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
    • To: System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
  • Updated Resources.Designer.cs
    • From: [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
    • To: [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]

After the above changes I am able to set the target framework to .NET Framework 4 and build successfully but am getting a runtime error:

  • Could not load file or assembly 'MICROSOFT.PRACTICES.ENTERPRISELIBRARY.DATA.RESOURCES.DLL' or one of its dependencies.

I have verified that all the Resources are being embedded within the output assemblies using .NET Reflector - yet at runtime the Enterprise Library is trying to dynamically load them from an external assembly.

So, the overarching questions is: What do I need to do to get the Enterprise Library 4.1 run when compiled for .NET 4 (CLR4)?

Moving to Enterprise Library 5.0 would introduce a lot of risk during my current iteration and was hoping to put it off till a later date so any and all help would be appreciated.

Apr 5, 2011 at 2:35 AM
Edited Apr 5, 2011 at 6:27 AM

I read from this thread that this behavior is due to a change in .NET 4.0.  Although I tried a simple data access code using EntLib 4.1 with .NET 4.0, I don't get this error message and it actually works fine.  I'll investigate more on this and keep you posted for any updates.

Could you also point out what specific line of code triggers this error on your end?  It would help if I could repro this.

 

Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.
entlib.support@avanade.com

Apr 5, 2011 at 2:21 PM
Edited Apr 5, 2011 at 2:24 PM

Outstanding link.  This is exactly what I am looking for, thanks.

I have an Assembly Loader class where we are NOT leveraging the resources.dll files so my errors where all based around this class.  I have resolved my issues, thanks for the link and quick reply.

 

May 2, 2014 at 6:09 PM
I am facing with that same issue. How did you resolve it?