Thursday, August 30, 2007

Output paths in Web Application Projects (VS.NET 2005)

I've recently started using the Web Application Project (WAP) in Visual Studio 2005 to allow me to create assemblies containing controls, including User Controls.

Works like a charm. I'm embedding the layout code (.ascx) as a resource and using a VirtualPathProvider to extract the resource for compilation in the site.

All nice and good. Until I started converting my older projects to WebApplication projects. For some reason the designer was refusing to render controls from external assemblies (like ASP.NET Ajax controls).

It was giving me nothing but gray boxes saying "Error Creating Control". No indication as to what was wrong... Turns out the designer expects all referenced assemblies to be in the /bin folder. Makes sense for a web project, but I'd expect VS to use the output folder for the current target (Release, Debug etc.) in a WAP.

Anyway, I've updated the output paths for all targets and all works fine now.