I’ve got an ASP.NET project with some custom controls, which subclass some standard controls.  Eg. MessageLabel subclasses Label, and adds some additional formatting and css properties.

Compiled controls are in same web project, in the MyProject.Controls namespace, and referenced into the project through web.config by adding the following under system.web -> pages -> controls.

<add tagPrefix=”myproj” namespace=”MyProject.Controls” assembly=”MyProject” />

On ASPX pages, controls are added using the following syntax:

<myproj:MessageLabel ID=”MessageLabel1″ runat=”Server” />

Except, this breaks the designer file! As soon as the control is added to the page, adding any additional controls or saving the page will show the following error in the errors list:

Generation of designer file failed: Unknown server tag ‘myproj:MessageLabel’

This is a big annoyance, as it means that this and any other controls added to the page will not be updated in the [no-longer] generated designer file, stopping them from being accessed in the code-behind.

The only workaround I’ve found is to manually add the register directive at the top of each ASPX page:

<%@ Register Assembly=”MyProject” Namespace=”MyProject.Controls” TagPrefix=”myproj” %>

…which completely defeats the purpose of adding the assembly reference in web.config.  Some other people experiencing this problem a while back reported that it was fixed in VS2005 SP1, but I’m using SP1 and in my experience it doesn’t seem this is the case.

Very, very annoying.