I want to document for the posterity that one could get this error even if you don't have an App_Code directory but if all of the following is true:
* You are using a Web Applications Project. (Perhaps you migrated from 1.1 like I did.)
* You are also using a Web Deployment Project.
* You have a "CodeFile" page directive in the some page markup instead of "CodeBehind". (How? I don't know. Could be because of certain migration issues between 1.1 and 2.0. )
In this scenario, when MSBuild compiles the wdproj file, it compiles this page into the <Project>_deploy.dll in addition to the regular <Project>.dll. This results in duplicate class names and hence the runtime error.