开发者

ASP.net - First build fails with 'Unknown server tag'

开发者 https://www.devze.com 2022-12-22 09:33 出处:网络
I have multiple custom controls used on a ASPX (and C#) page registered from within the page rather than in Web.Config.

I have multiple custom controls used on a ASPX (and C#) page registered from within the page rather than in Web.Config.

On the first bu开发者_Go百科ild (or rebuild), build fails with error messages for wherever I've used the custom controls. Subsequent builds are successful.

The error message:

Unknown server tag 'prefix:ExampleControl'.

What might cause this, and how can I fix it?


Register syntax:

<%@ Register Src="ControlsFolder/ExampleControl.ascx" TagName="ExampleControl" TagPrefix="prefix" %>
<!-- etc -->

Usage syntax:

<prefix:ExampleControl runat="server" ID="ExampleControl1" />
<!-- etc -->


Is this in VB.Net? VB has a "helpful" way of handling namespaces that can be really confusing. Have you tried deleting and recreating the control?

0

精彩评论

暂无评论...
验证码 换一张
取 消