Over the years, almost all members of our development team have experienced some kind of problems with IntelliSense in Visual Studio. This feature is a great help while it works; however, once it stops working it can be a nightmare to figure out what exactly went wrong. One of the most common situations is characterized by two notorius error messages: "The language referenced by the Language attribute is not supported by Visual Studio IntelliSense and statement completion"
and "Unrecognized namespace 'asp'"
. The first message is related to the @Page declaration in the header of the page, while the latter is displayed wherever you have an ASP.NET control, no matter how simple it may be (textbox, label, whatever). At the same time, the VS control toolbox will be empty or, alternatively, all controls in the toolbox will be disabled.
We have discovered that this scenario can be caused by a few totally unrelated combinations of various settings:
- broken Microsoft Visual Studio Web Authoring Component installation in VS 2008. It appears that this is a component of Office 2007 that is used for visual authoring of Web pages in Visual Studio, and can be messed up by many things: upgrade to Office 2010, various hotfixes, etc. Fortunately, the reinstallation/repair process is relatively easy - once you know where to look at. Just locate the package in the Control panel -> Programs and features, and run a repair or reinstall, you will have to use the VS installation disk during this process.
- broken ReflectedSchemas (xsd files that are used by VS to automatically detect the control members): this situation can be fixed by deleting the contents of the ReflectedSchemas folder (more information can be found here, note that the AppData folder in Windows 7 is located in c:\users\[username]\AppData\Roaming\...)
- using the wrong editor when accessing the ASPX files. Some of our users tend to replace the default (Web form) editor with the HTML editor (by right clicking on an ASPX or ASCX file in the solution explorer, Open with - Set as default). HTML editor is faster to work with, and is recommended by some when performance is critical. However, it cannot use the IntelliSense features, and people tend to forget this change in settings when they notice that some functionality is missing after a few days or weeks.