Unrecognized prefix tag or device filter in Visual Studio 2008

I have a set of web controls that are in the assembly referenced by the website. I can create and run everything without problems, however, when I look at the aspx page where the controls are used, I get a green underline under the tag prefix.

<%@ Register Assembly="MyProject.UI.ControlLibrary" Namespace="MyProject.UI.ControlLibrary.Web" TagPrefix="ControlLibrary" %>
<asp:Content ID="MainContent" ContentPlaceHolderID="MainContent" Runat="Server">
    <ControlLibrary:ListView ID="List" runat="server"/>
</asp:Content>

So, in this example, I get a green underline in the ControlLibrary, and when I hover over it, it says that the unrecognized tag prefix or device filter is "ControlLibrary"

The code was written in a previous version of Visual Studio, I have another assembly that also contains web controls and seems to work fine.

Any ideas on what might cause the problem?

+5
source share
5 answers

I don’t know why this works, but it is. When I change the namespace of one of the list controls in MyProject.UI.ControlLibrary from MyProject.UI.ControlLibrary.Web and rewrite case <%, then it works fine.

+1
source

Try changing the link in web.configand see what the error is, if any results? Here's an example of adding root tags <asp:for a location link. I like this approach because it also makes pages cleaner, if you use the library at all. See if you get the same result after moving the library link.

<system.web>
  <pages>
    <controls>
      <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />

.

Drive:\Documents and Settings\[User]\ApplicationData\Microsoft\VisualStudio\9.0\ReflectedSchemas

:

%APPDATA%\Microsoft\VisualStudio\9.0\ReflectedSchemas\

+3

<%@ Import %> <%@ Register %>:

<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>

<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
+3

, , ASP.NET XML Visual Studio . , , , :

  • .aspx . VS IntelliSense;
  • , .aspx . . , . - .
  • If all else fails, put the tag prefix definition in the web.config file:

    <configuration><system.web><pages><controls>
        <add tagPrefix="ControlLibrary" namespace="MyProject.UI.ControlLibrary.Web" assembly="MyProject.UI.ControlLibrary"/>
    </controls></pages></system.web></configuration>
    

    Of course, try rebuilding, etc.

+1
source

In my case, I found that if the control assembly is already registered in the prefix in the web.config file, and then you try to register it on another prefix using @register, you will get this error message.

+1
source

All Articles