C# – Unable to use Log4Net with .net Framework 4

clog4netloggingnet

We are planning to use Log4net in our application . But I am unable to import the "log4net" namespace if the target framework is 4.

I also get a warning
The referenced assembly "log4net" could not be resolved because it has a dependency on "System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove references to assemblies not in the targeted framework or consider retargeting your project.

So what is going wrong here ?

Note-Logging works if I change the target framework to 3.5
Note-This is a windows application .

Thanks in Advance.

Best Answer

On the projects properties page change the target framework from .NET Framework 4 Client Profile to .NET Framework 4