Visual Web Developer Express 2010 changes the target framework version of class library projects to 4.0 when upgrading from earlier versions


Symptoms


If you open a solution using Visual Web Developer Express 2010 which was created using previous versions of Visual Studio and the solution contains a .Net 3.5 website/Web Application Project with reference to a .Net 3.5 class library project, then when you open the project and choose to continue targeting the .Net 3.5 framework in the upgrade prompt, you may see various warnings such as:

The project 'ClassLibrary1' cannot be referenced. The referenced project is targeted to a higher framework version (4.0)

Cause


Class library projects (including asp.net server control library projects) automatically get upgraded to .Net Framework 4.0 when opened with Visual Web Developer Express 2010. The website that has a reference to this project is still targeting the framework version 3.5, and hence you may get warnings as the dependent project is targeting a higher framework version - .Net framework 4.0.

Resolution


To workaround these warnings and continue targeting .Net Framework 3.5, change the target of the dependent class library project from .Net framework 4.0 to 3.5.