If you create a new .NET 4.0 console application in Microsoft Visual Studio .NET 2010 and add a reference to the Log4Net v1.2.10 dll, you can add the using statement [using log4net;], but after a rebuild, Microsoft Visual Studio still reports the error:

Error    29    The type or namespace name ‘log4net’ could not be found (are you missing a using directive or an assembly reference?)

This is caused by the [Target framework] is set to the [.NET Framework 4 Client Profile]. This profile does not include some .NET assemblies found in the Full .NET Framework, that are used by log4net.

image

 

As can be seen with RegGate Reflactor, log4net uses Full .NET Framework assemblies:

image

 

Solution

Set the [Target framework] of your application to [.NET Framework 4].

image

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.