Tuesday, June 9, 2009

Generation of designer file filed: Unknown server tag

I was nearly pulling my hair out after struggling with this error in Visual Studio 2008 for about 3 hours. I did a search for this error message and found a couple of suggested solutions to this error, but none of them could actually solve my problem. Part of the problem is that I'm working in a slight different scenario than most of the solutions posted, so that might explain why those solutions couldn't solve my problem (I'm working in a multi-project solution in Visual Studio 2008).

So, basically this is what happened:

Spent the last couple of days building a set of classes that handles most of the database linking, error engine and session management for any ASP.Net application. Everything worked great and I'm very pleased with how well it binds together and the performance is top notch. I'm calling this my very own Framework, constructed over the .Net Framework. But as Alanis Morissette would say in a song, life has a funny way of sneaking up on you when everything's alright... As soon as I was ready to add a new project into my solution and use my Framework inside the same solution as a reference in the new project and take full advantage of my work on that, I get this nasty error:

Generation of designer failed: Unknown server tag 'ajax:xxxx' (The name of the control in question is irrelevant)

So, a couple of hours later and tried at least three different solutions nothing worked. Moving the assembly and namespace declaration from the web.config to the top of the aspx page didn't work and viceversa. Restarted several times the Visual Studio and it didn't work either. Checked the bin folder 5 times to make sure that the AjaxControlToolkit.dll was there, and effectively, it was there. For a minute considered rewriting most of my pages to avoid using Ajax controls, but that would have been a pain in the ass, so I ruled that possibility out, there must be a solution to this, right?

Another hour goes by and I decided to do a sanity check. I right-clicked the root of the project that was giving me the error (remember that this is a multi-project solution), and selected Add reference. A huge list of .NET assemblies are loaded into the list, but couldn't find the AjaxControlToolkit reference there, so I moved to the Browse tab and navigate to the bin folder of the project. The dll is there, but I decide to add it even if it's already in the bin folder... And guess what? It worked! I went back to the project and opened the page that was giving me the error and this time the error was gone. Problem solved.

I wish I knew this sooner, I wasted 3 hours looking for a solution to this and after reading bizarre and vague recommendations I decided to look for a solution on my own. I was lucky this worked for me, hope this helps someone else too.

-reno812

No comments:

Post a Comment