28

I've thrown together some code to tinker with the new .Net 4.0/VS 2010 pieces, but I can't seem to find a build of my logging framework of choice (log4net) for 4.0, and I'm getting reference errors with the 2.0 version. Is there a 4.0 version available somewhere? I'm not asking for new features, just a version that's already been rebuilt against the new assemblies. Anyone know where I can find a build of 1.2.10 built for the 4.0 framework?

3
  • I think I remember seeing in-proc side-by-side for 2.0/4.0-compat, but that doesn't appear to allow my 4.0 code to reference the 2.0 log4net library. Nov 19, 2009 at 23:13
  • Have you tried taking a log4net source project and running it through VS2010's upgrade process?
    – RCIX
    Nov 19, 2009 at 23:22
  • I have pulled the source for 1.2.10 from the SVN server and run it through the upgrade process. It looks like so long as I define the _NET_2_0 symbol and add attribute to get the Level1 security-enforcement rules, things work. Obviously, there's more work involved for the complete 4.0 update, so I'm hoping someone has already started on that work. Nov 20, 2009 at 1:31

1 Answer 1

39

log4net has a known issue of referencing a System.Web component which is not part of the .NET Framework 4 Client Profile and the VS2010 by default sets project target to be the lightweighted Client Profile. The solution is to change the target to .NET Framework 4:

Right click project -> properties -> Application. Change:

 .NET Framework 4 Client Profile

to be:

 .NET Framework 4

... and that should work, i.e. you can use log4net again...

3
  • I should say the latest releases already added support for Client profile, so no need to target the full one. Oct 18, 2011 at 19:53
  • 4
    Downloaded today latest release, it doesn't support ClientProfile with .NET 4.0
    – Dzmitry
    Dec 17, 2011 at 14:23
  • 6
    Just downloaded latest binaries (1.2.11) and it contains a version compatible with 4.0 Client Profile in \bin\net-cp\4.0\release. Just tested it and works like a charm !
    – SvenG
    Apr 20, 2012 at 9:06

Not the answer you're looking for? Browse other questions tagged or ask your own question.