Monthly Archives: March 2012

Referenced assembly could not be resolved because it has a dependency which is not in the currently targeted framework

If you are using third-party development tools (like Ninject) with your .NET 4.0 project.  You may get the following error at compile time:

Warning: The referenced assembly "<Assembly>" 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.

This error is a result of .NET 4.0 targeting (by default) the .NET Framework 4 Client Profile.  This profile is a subset of the full profile and does not have the entire .NET class library.  To fix, go into Project Properties  | Application, and change the target framework to: .NET Framework 4.  Visual Studio will prompt you that your solution must be closed and reloaded.  Once you do this, the project should compile as expected.