Category Archives: visual studio

Picking the right .NET Framework Version with Specific Reference

This morning I needed to work on a long-standing ASP.NET web application project. I haven’t had to run it locally for quite a while. I updated my source from TFS, cleaned and built the solution, and started the project in debug mode. After logging in, I went to a page, and was suddenly staring at an unexpected and confusing exception:

The base class includes the field 'ScriptManager1', 
but its type (System.Web.UI.ScriptManager) 
is not compatible with the type of control 
(System.Web.UI.ScriptManager).

I put aside the surprise that a type was not compatible with itself, and checked the source control history. The specific page hadn’t been changed since the last time I’d tried it. I know the project is under active development, including a recent deployment of the latest version at the client site, so I had ever reason to believe the build should work.

Before sending a panicked email to my team, I did a quick Google search. I found a couple links of similar people with this problem in VS2008, but I’m still running VS2005.

I realized, however, that I had installed Framework versions 3.0 and 3.5 since I had last had to work on this project. I went to the project references, and checked that for System.Web.Extensions, and noticed that “Specific Reference” was set to false. I set this to true, rebuilt the project, and started the debugger again.

This time, success! The page displayed as expected.

What problems have you encountered from having multiple .NET Frameworks installed?