Can Ent Lib 4.0 be used from a .NET 4 application?

Topics: General discussion
Sep 3, 2014 at 11:02 AM
I have written an extension to an existing host application. The host application uses EntLib 4.0 without registering the libraries in the GAC. I had developed the extension using C# .NET 4 and EntLib 5 not knowing that this would conflict because my extension's files can only be deployed into the same folder as the host application. My extension also does not register the EntLib libraries in the GAC.

I am now trying to change my code to use EntLib 4.0 but it is not working. At this point I would just like to verify that it is valid to use EntLib 4.0 in a C# .NET 4 application.

Any comments?
Sep 4, 2014 at 6:29 AM
You should be able to use EntLib 4.0 with .NET 4.0.

What blocks are you using and what behavior(s) are you seeing?

Randy Levy
Enterprise Library support engineer
Support How-to
Sep 5, 2014 at 11:43 AM
Edited Sep 5, 2014 at 12:49 PM
I think I'll register the EntLib 5 libraries in the GAC first to see if that route will work.
Sep 5, 2014 at 12:46 PM
Putting the assemblies in the GAC shouldn't make a difference unless the EntLib assemblies are not deployed with the application.

gacutil.exe doesn't need the version information for installing in the GAC. But you can get the PublicKeyToken by using sn -T <assembly>. However, all EntLib 4 assemblies should have version number (and for EntLib 4.1) and PublicKeyToken 31bf3856ad364e35 (unless a custom build is being used).

Randy Levy
Enterprise Library support engineer
Support How-to
Sep 5, 2014 at 1:19 PM
Thanks for the info. I registered the EntLib 5 libraries in the GAC but in doing that the host application stopped working (lots of errors).
I think I'll have to go back to basics and understand how to use EntLib4.0 in my code. (The host app has local copies of Common 4.0, Logging 4.0, ObjectBuild2 2.1 and Unity 1.1. We won't get support from the vendor if we overwrite these files with the version 5 equivalents. How unsporting!).
Sep 15, 2014 at 8:44 AM
I'm glad to report that I have successfully worked out how to use EntLib4 instead of EntLib5 subject to testing.