C# Visual Studio 2008中无法识别的标记前缀或设备筛选器

C# Visual Studio 2008中无法识别的标记前缀或设备筛选器,c#,visual-studio-2008,asp.net,C#,Visual Studio 2008,Asp.net,我有一组web控件,它们位于网站引用的程序集中。我可以毫无问题地构建和运行所有东西,但是当我看到正在使用控件的aspx页面时,我会在标记前缀下面看到一条绿色下划线 <%@ Register Assembly="MyProject.UI.ControlLibrary" Namespace="MyProject.UI.ControlLibrary.Web" TagPrefix="ControlLibrary" %> <asp:Content ID="MainContent" Con

我有一组web控件,它们位于网站引用的程序集中。我可以毫无问题地构建和运行所有东西,但是当我看到正在使用控件的aspx页面时,我会在标记前缀下面看到一条绿色下划线

<%@ 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>

所以在这个例子中,我会在ControlLibrary下得到一条绿色下划线,当我将鼠标悬停在它上面时,它会显示无法识别的标记前缀或设备过滤器“ControlLibrary”

代码是在VisualStudio的早期版本中编写的,我有另一个程序集,它也包含Web控件,看起来工作正常


关于问题的起因有什么想法吗?

很难说原因是什么,但是Visual Studio中的ASP.NET XML解析器通常会遇到类似的问题。以下是我发现的一些可能的解决方法,其中一些可能也适用于您:

  • 打开.aspx文件后,请稍等。VS需要一段时间来解析文件并设置其IntelliSense
  • 在.aspx文件打开并显示在屏幕上时,尝试编译项目。成功的构建通常会解决这些问题。如果这不起作用,请尝试重建项目,甚至整个解决方案。再说一次,等一下
  • 如果所有其他操作都失败,请将标记前缀定义放在web.config文件中:

    <configuration><system.web><pages><controls>
        <add tagPrefix="ControlLibrary" namespace="MyProject.UI.ControlLibrary.Web" assembly="MyProject.UI.ControlLibrary"/>
    </controls></pages></system.web></configuration>
    
    
    
    当然,尝试重建等等


尝试将引用更改为位于
web.config
中,如果出现任何错误,请查看错误?下面是一个root
的示例,不知道为什么会这样,但确实如此。当我将一个listview控件的命名空间从MyProject.UI.ControlLibrary.Web更改为MyProject.UI.ControlLibrary,并在本例中重新指向时,我发现如果控件程序集已注册到Web.config中的前缀,然后您尝试使用@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" %>


很好的建议,这些解决了我遇到的其他问题,但不是这个问题。是的,我也是它的忠实粉丝,我在上一次研究这个问题时换了一个,所以我现在就是这样做的。没有区别。删除reflectedSchema对我很有效,所以谢谢你的回答。这是-1,因为答案与问题的确切解决方案不匹配吗?如果您尝试此场景,它会重复问题中提到的条件。我可以看出我的回答是否完全不正确,但是-1表示答案与问题无关,没有提供细节,或者不正确或有误导性。否则,你可能只想留下一个答案,因为在其他人的情况下,它可能是问题的原因。太好了。这正是我的VS2012 SharePoint 2010应用程序页面所需的Intellisense问题。
<%@ 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" %>