locked
Duplicate classes with Web Application Project RRS feed

  • Question

  • User-1096946240 posted

    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]

    Regards

    Paul

    Tuesday, November 27, 2007 5:58 AM

All replies

  • User-46028669 posted

    Thanks for sharing your experience. I think duplicate classes may still exist if namespaces are different.

     

    Tuesday, November 27, 2007 6:51 AM
  • User1436822401 posted

    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 http://undocnet.blogspot.com/2007/11/web-application-project.html .

    Wednesday, November 28, 2007 9:49 AM