Solving “The type or namespace name … could not be found” error in Microsoft Visual Studio

When you compile a .NET 4.0 C# application the following error message appears:
The type or namespace name … could not be found (are you missing a using directive or an assembly reference?)

There is also a warning message :
The currently targeted framework “.NET Framework,Version=v4.0,Profile=Client” does not include “System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” which the referenced assembly ….dll” depends on. This caused the referenced assembly to not resolve. To fix this, either (1) change the targeted framework for this project, or (2) remove the referenced assembly from the project.

Cause:
The project targets the .NET framework 4.0 Client profile, but some functionality in the referenced project is not supported by the Client profile.

Solution:
Set the Target Framework of you project to “.NET Framework 4.0”

  • In the Solution Explorer right click the project and select “Properties”,
  • On the “Application” page set the Target Framework to “.NET Framework 4.0”.

Leave a comment

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