Recently I came across this error when calling MSBuild from the command line and building a project which I thought was targeted at framework 3.5. So why was it trying to reference .NET framework tools version 4.0
Well the answer was that I developed the project in VS2010 but targeted framework 3.5. When a project is developed in VS2010 the project file is created with a default ToolsVersion reference to 4.0.
Open the csproj file and right up the top you will notice something like
<Project ToolsVersion=”4.0″ DefaultTargets=”Build” xmlns=”http://schemas.microsoft.com/developer/msbuild/2003“>
To remove the warning message, just edit the toolsversion to be the version of the framework you are targeting e.g. 3.5