Search code examples
c#asp.netcomponentart

Moving code around results in "unrecognized tag prefix or design filter" error


I have a Visual Web Developer 2010 Express Edition Web Application. The Default.aspx starts off as follows:-

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MixedZone.Default"%>
<%@ Register assembly="ComponentArt.Web.UI"
             namespace="ComponentArt.Web.UI"
             tagprefix="ComponentArt" %>
<%@ Register TagPrefix="MixedZone"
             TagName="NumberInput"
             Src="Common/UserControls/NumberInput.ascx" %>

The NumberInput.ascx starts like this:-

<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="NumberInput.ascx.cs" Inherits="MixedZone.UserControls.NumberInput" %>
<%@ Register assembly="ComponentArt.Web.UI" namespace="ComponentArt.Web.UI" tagprefix="ComponentArt" %>
<asp:Literal ID="Literal1" runat="server" Visible="False"></asp:Literal>
<ComponentArt:NumberInput ID="niNumberInput"
                          runat="server"
                          CssClass="valid"
                          ...etc

So far, so good. But I wish to move this code to a different directory. I do this (editing the csproj file by hand) and change the aspx and aspc files accordingly:-

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MixedZone.Default"%>
<%@ Register assembly="ComponentArt.Web.UI"
             namespace="ComponentArt.Web.UI"
             tagprefix="ComponentArt" %>
<%@ Register TagPrefix="MixedZone"
             TagName="NumberInput"
             Src="../MixedZone/Common/UserControls/NumberInput.ascx" %>

and

<%@ Control Language="C#" AutoEventWireup="True" CodeBehind="../MixedZone/Common/UserControls/NumberInput.ascx.cs" Inherits="MixedZone.UserControls.NumberInput" %>
<%@ Register assembly="ComponentArt.Web.UI" namespace="ComponentArt.Web.UI" tagprefix="ComponentArt" %>
<asp:Literal ID="Literal1" runat="server" Visible="False"></asp:Literal>
<ComponentArt:NumberInput ID="niNumberInput"
                          runat="server"
                          CssClass="valid"
                          ...etc

but when I do so, the ComponentArt: is marked with the green underline, and the message

Unrecognized tag prefix or device filter 'ComponentArt'

(about five hundred compilation errors appear as a result). The directory Common\UserControls was moved in its entirety, and nothing else has been changed. Does anyone have any idea what the problem might be and what I might do about it?


Solution

  • I worked around this problem by using SubVersion to include the code in the old location even though it isn't "really" there. I don't like this very much as it seems like a clever-clever trick and a trap for future maintenance. But it won't have the directory if it isn't below the project's, and it won't follow a shortcut if I place one there.