Last post Nov 28, 2007 09:49 AM by Dancoe
Nov 27, 2007 05:58 AM|pwhatcher|LINK
Just thought I'd post this as it took me a few days to work out what was going on....
We have a web application that was working fine in development and production, then we added some custom AJAX stuff into it. It carried on ok in development, but in production the AJAX areas failed when we tried to dynamically add elements to the home page.
Finally tracked down the problem; nothing to do with AJAX - someone added a control and a page to the WAP project from another site, but not converted it to CodeBehind, so there was a duplicate class definition - one in the WAP project and one in the the
compiled deployment project.
So, if you get duplicate class errors, check for any CodeBehinds in your WAP project [:D]
Nov 27, 2007 06:51 AM|moredotnet|LINK
Thanks for sharing your experience. I think duplicate classes may still exist if namespaces are different.
Nov 28, 2007 09:49 AM|Dancoe|LINK
This behavior is actually wrong, the code behind attribute is only there for compatability with asp.net 1.1 as it is stated on msdn. code file should be used instead. the only reason why they are still using that is to enable people to do edit and continue.
otherwise you cant it. if you dont want to get the error u are getting there is two way to go about it. one is to do what you did and change all code files to code behind the other is to leave the code file attribtues and set the build action on all code behind
files i.e. .cs and.design.cs to none that will stop csc.exe from compiling the page again into the project main dll. doing this will also make the web deployment project start working properly with the web application project you will be able to compile using
all the 4 compilation types that ship with it, single page assemblies, single folder assemblies etc.
In my blog entry you can see an explanation in detail about this.
have a look at my blog post
Web Application Project
Web Deployment Project