Confusing Bug: ASP.NET customer control refuse to work

I was converting a VS.net 2003 web application into VS 2005 project. Hundreds bugs turned up. I know that some of the bugs are not real, they are there only because other real bugs, but the compiler will complain them anyway. Here comes the Wisdom to choose which file to fix first, sadly, I haven't got much of it.

Noticed an error message complaining about this line in a .ascx file:
<MyTag:MyControl1 id="control1" runat="server" />

I found the Directive line at the top:
<%@ Register TagPrefix="MyTag" Namespace="MyNameSpace" Assembly="MyAssembly" %>

Since my control code is inside the \App_Code folder now (that's new in VS 05), there won't be an DLL file to refer to, so I removed the Assembly="MyAssembly" pair. Still, it doesn't work. Stared at the code for a long time, can't figure any error there. So I created a new web project, added the control code into \App_Code, declared my tag, it WORKs.

Only at this point, my rational thinking comes back from a beach holiday (I guess). Since \App_Code is holding lots of code files, VS 05 must be compiling it to a temp place, i.e. the whole folder into a single DLL, to be referenced by webforms, if a single bug in any files prevents this DLL to be compiled, then you just don't have that dll, then, you have nothing at all.

So, my customer control code is bug free, .ascx file too. It's some other files I should look at, really!
Published 09 August 2006 20:07 by dong
Filed under: ,

Comments

No Comments