Enterprise Library and .NET 4.0 beta 1 - it doesn't work

Topics: Enterprise Library Core, General discussion, Pre-release discussions
May 19, 2009 at 8:04 PM

With the release of .NET 4.0 beta 1, I know at least some folks will be trying to compile their entlib projects with it. At this time, we know that this will not work. Due to this bug:


.NET 4.0 beta 1 cannot load any CLR 2.0 assembly that uses certain kinds custom attributes. Since entlib (and most other .NET projects) use custom attributes heavily, you'll get a load error when you try to reference our existing binaries with beta 1.

The Entlib team is tracking the state of this error, and our intention is to have binaries that will work against .NET 3.5 sp1 or .NET 4.0 with no changes. But unfortunately .NET 4.0 isn't there yet.



Jul 2, 2009 at 3:31 PM

Would you anticipate that this issue would be corrected by the time that beta2 is released?

Also, when I attempted to use some Entlib assemblies within a .NET 4.0 beta 1 project, I was presented with some errors during compilation related to indirect references to .NET 2.0 assemblies such as System.Management. Is this issue related to the one you mention above?

Sep 2, 2009 at 7:35 PM
Edited Sep 2, 2009 at 10:56 PM

Whats the current status of getting the binaries to work against .NET 4.0?

Were moving forward on a project and would like to use the Caching Application Block but our concern is, will it be ready in time.




I suppose if I would of completely read the bug in the link above I would of seen that the issue has been resolved and will be pushed with the next version of .Net and VS.

Dec 17, 2009 at 10:07 PM
Edited Dec 17, 2009 at 10:07 PM

The current status is that we haven't done work against .NET4.0 yet. We are going to in the next couple of months. It will be ready by the time .NET4.0 ships.

The bug in the framework has been fixed and closed.

You can see someone has already tried building EntLib5.0 current drop against .NET4.0 beta2 (http://entlib.codeplex.com/Thread/View.aspx?ThreadId=77923). You may want to try that or wait till we release 5.0 final.


Dec 18, 2009 at 1:03 AM

Hi All,

I have indeed been successful compiling EL 5 drop 61455 against .NET4.0 beta 2. I have not encountered the specific problem that was reported with beta 1. However, there is on BIG issue with the new security model in .NET4. The P&P team will eventually have to choose a strategy for revamping code related to permissions.

There doesn't seem to be any problem rebuilding EL 5 against beta 2 as long as you only intend to link against all FULL TRUST assemblies (for example, anything in the GAC). The tests for various permissions manipulations will not work correctly the way they are currently written.

I am in the process of configuring a build of EL 5 drop 62268. If you can live with FULL TRUST ONLY you can download my previous build at Composure or wait for the build I will post there in the next day or two. That will be using pragmas to handle 3.5 or 4.0 depending on conditional compilation ("NET4_FULL_TRUST"). I am not yet sure whether or not this will resolve ALL of the issues. But it seems to be properly handling most of them (as far as I can tell at the moment).

*DISCLAIMER:* Only use my build if you want to experiment. *PLEASE DO NOT* use it in production. Better to wait for the P&P team to create the release version.