You are here
Home > Programming > Log4Net and Visual Studio 2010 Windows Application Build Error – SOLVED

Log4Net and Visual Studio 2010 Windows Application Build Error – SOLVED

Fallback Image

I just wanted to post a quick note here regarding a build error I got for the Log4Net Logging Service and Visual Studio 2010. I added the Log4Net DLL and some logging to my application, but on the Build, I received the following Warning:

The referenced assembly “log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821, processorArchitecture=MSIL” 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

Log4Net Error Solution

This simply means that the Log4Net DLL relies on some classes in System.Web and isn’t included in the current selection of your .NET Framework. This is because you can choose two types of .NET Framework 4. These are the Client Profile and the Full framework. When do I use NET4 Client Profile and when do I use NET4 Full Framework I hear you say? See here for an article.

Meanwhile, go to your Project Properties (Visual Studio Menu bar: Project ->[ProjectName] Properties…). You should see that the framework is selected to .NET Framework 4 Client Profile. Change this to the .NET Framework 4 and save. Rebuild your project and you’ll be good to go.

Log4Net Visual Studio Framework

Dirk Strauss
Dirk is a Software Developer from South Africa. He loves all things Technology and is slightly addicted to Jimi Hendrix. Apart from writing code, he also enjoys authoring books and articles. "I love sharing knowledge and connecting with people from around the world. It's the diversity that makes life so beautiful." Dirk feels very strongly that pizza is simply not complete without Tabasco, that you can never have too much garlic, and that cooking the perfect steak is an art he has almost mastered.
https://dirkstrauss.com

Similar Articles

Top