I just recently converted over a rather large Web App in VS2005 using the old model of just write and run using the Built In Web Server for development then using the Depoyment Project to build and upload to an IIS server. Always worked fine.
Now I've converted over to a WAP and even well renamed some name spaces which worked poorly, but still elimnated alot of work but it of course missed all the ASPX files that mentioned the name space. This is a refactor bug that I hope is fixed someday.
Anyhow I get "Unknown Server Tag" errors when I run the app now. For example.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<%@ Register TagPrefix="it" Namespace="WebApplication1.classes" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<% _lb.Text = System.DateTime.Now.ToString( ); %>
<asp:Label ID="_lb" runat="server" />
<it:TextBoxEx ID="_tbex" runat="server" />
</div>
</form>
</body>
</html>
would produce this error.
Error 1 Element 'TextBoxEx' is not a known element. This can occur if there is a compilation error in the Web site. C:\Documents and Settings\dking\My Documents\Visual Studio 2005\Projects\WebApplication1\WebApplication1\Default.aspx 13 13 WebApplication1
TextBoxEx is in the directory classes
namespace WebApplication1.classes
{
public class TextBoxEx : System.Web.UI.WebControls.TextBox
{
public TextBoxEx( ) : base( )
{
Text = "Hello World";
}
}
}
Ok All this code just to make this one point however in the ASPX file you could write a register statement like this.
<%@ Register TagPrefix="it" Namespace="WebApplication1.classes" %>
but this won't work because it won't be able to find the Assembly, but what we want is it to use the assembly that the entire project is compiling to.
Before using a WAP this would work fine and it would compile. Or you could do something like this
<%@ Register TagPrefix="it" Namespace="WebApplication1.classes" Assembly="__code" %>
And this would also work, but now it doesn't the only thing that I have found that works would be to do this.
<%@ Register TagPrefix="it" Namespace="WebApplication1.classes" Assembly="WebApplication1" %>
So I must use the assembly name of the project in every place that I used a compiled in simple tweak of a .NET web control
How can I specifiy to register the control using the project assembly file in an abstract way? like saying __code or not putting an assembly attribute at all?