5

I just installed the release version of Visual Studio 2010, and it looks like there's something wrong with the standard ASP.NET server controls.

When I create a basic server control, such as a TextBox, the editor underlines it in green and says (I also get no intellisense for ASP.NET controls):

Element 'TextBox' is not a known element. This can occur if there is a compilation
error in the Web site, or the Web.config file is missing.

The web site builds fine, and the Web.config file is not missing:

<?xml version="1.0"?>
<configuration>
<system.web>
  <compilation debug="false" targetFramework="4.0" />
</system.web>
</configuration>

The controls work just fine in the code-behind, and they function correctly when I run the site.

Is there some configuration problem here?

Liam
  • 53
  • 1
  • 3

4 Answers4

14

This person who's a tester on the Visual Web Developer Team offered this workaround, which apparently worked:

Close VS, delete schema cache, and re-open VS. You can find the schemas under something like:

C:\Users\Pavel\AppData\Roaming\Microsoft\VisualStudio\10.0\ReflectedSchemas

It is safe to delete all files in this folder.

DOK
  • 32,337
  • 7
  • 60
  • 92
3

I've encountered the same problem, but deleting the cache didn't solve it for me.

However based on the other answer, I modified the already set master page path in the .aspx file (MasterPageFile="~/MasterPage.master") to something nonexistent, saved the file, then changed it back to the original path. After this the underlining was gone, and intellisense worked properly.

Funny that this is still a thing 2020. Using VS2019 Community.

Zsapi
  • 31
  • 2
0

Extension on the question as your solution didn't work for me.

I was seeing this in my SharePoint 2010 Application Pages which did not specify a masterpageurl in the Page tag.

Solution: After setting MasterPageURL="~masterurl/default.master" to the Page tag in the designer, it fixed all my ASP tags.

0

In my case, I noticed the MyPage.aspx.designer.cs was missing. Once i made a copy of existing file and defined the controls, all was set.

Please note for me, there were three files.

MyPage.aspx
MyPage.aspx.cs
MyPage.aspx.designer.cs

The definition of controls looks something like this:

  protected global::System.Web.UI.HtmlControls.HtmlInputText txtName;

    /// <summary>
    /// txtAddress control.
    /// </summary>
    /// <remarks>
    /// Auto-generated field.
    /// To modify move field declaration from designer file to code-behind file.
    /// </remarks>
    protected global::System.Web.UI.HtmlControls.HtmlInputText txtAddress;