R – Deployment Project dlls cause ‘type x exists in both’ errors

asp.netweb-deployment-project

I have a WebApplication project, a business logic project, and a WebDeployment project for the web app.

When I build solution, the deployment "Release" bin contains 1 dll for each of the projects – so I get one for MyWeb.dll, MyWebBusiness.dll, and MyWebDeploy.dll.

When I try to run the site, it sees the same type in both MyWeb.dll and MyWebDeploy.dll and chokes.

Error message:
CS0433: The type 'AV' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\53d45622\6c032bd2\assembly\dl3\33f3c6b2\abc9430a_285ac901\MyWeb.DLL' and 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\53d45622\6c032bd2\assembly\dl3\631e5302\0231160d_285ac901\MyWebDeploy.DLL'

Best Answer

Some reasons I can think of:

  • You have an App_Code directory in your project
  • You have a CodeFile page directive in the some page markup instead of CodeBehind