views:

780

answers:

2

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'

+4  A: 

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
Darin Dimitrov
Your "CodeFile" hunch was correct - we had converted from a VS 2005 project some master pages that had CodeFile instead of CodeBehind. Once replaced, it no longer produced the deploy dll. Thanks!
Chad
Thanks! Accidental CodeFile attribute.
Pete Montgomery
Essentially just convert the files it complains about to a "Web application" using the item that appears in the context menu when you right click on the items.
John_
A: 

There's a great forum post on this at: http://forums.asp.net/t/980517.aspx

Seems that all it takes is the right bit of code in the Web Application project and and VS says 'Oh, this is a website project so I'd better autocompile it', and then falls over when it finds it has already been compiled as a single DLL as well.

Causes listed by Darin above are the primary culprits.

Note that it is possible to get a similar error by accidentially having two references to the same assembly, double references in your web.config assemblies section, or accidentally dropping a duplicate copy of a codefile into a folder in the project, but these will usually be pretty obvious if you have debugging switched on in your web.config, and the error message should mention an assembly other than the Web App assembly {WebAppName}.dll and auto-compiled assembly App_Web_{number}.dll

There are quite a few people saying (in the referenced thread) that event handlers were causing problems, but I think it's just that there is something weird in the code behind which is being interpreted as requiring an autocompile. I'm in the same boat, I have cut and pasted a whole bunch of sample code into my web application, and checked all the above. However, a lot of the pages have code behind which have the 'Web Form Designer generated' code on them already, so when I right click the application on solution explorer and choose 'convert to web application', nothing happens. The old code stays there and the double compilation continues.

So I'd say in addition to these posts: If the code has been cut and pasted and there is something the converter doesn't like, it won't convert it and the double compilation will continue. The only solution is to add the offending pages as new items, copy markup and code over (bit by bit if necessary), then remove the old versions.

In my case, I just went to a Web Site for the project because i couldn't be bothered and it was only a demo project anyway.

Ben McIntyre