Asp.net-mvc – Error: The type exists in both directories

asp.netasp.net-mvc

In a MVC2 project I moved a file from App_code to Content folder and compiled it. Then move it back again to App_Code and then changed its Build Action to "Compile". Now I get this error and I don't know how to fix this to make my program work again:

CS0433: The type 'Helper' exists in
both
'c:\Users…\AppData\Local\Temp\Temporary
ASP.NET
Files\root\b00d4b7d\b2553f9c\App_Code.zowyklar.dll'
and
'c:\Users…\AppData\Local\Temp\Temporary
ASP.NET
Files\root\b00d4b7d\b2553f9c\assembly\dl3\5c6d3537\19f85663_cde9cb01\MyProject.DLL'

Cleaning and Rebuilding doesn't solve the problem.

Best Answer

This has been answered in a separate question and resolved the problem for me. Be sure to vote up the original person's answer.

ASP.Net error: "The type 'foo' exists in both "temp1.dll" and "temp2.dll"

Add the batch="false" attribute to the "compilation" element of the web.config file.

This problem occurs because of the way in which ASP.NET 2.0 uses the application references and the folder structure of the application to compile the application. If the batch property of the element in the web.config file for the application is set to true, ASP.NET 2.0 compiles each folder in the application into a separate assembly.

http://www.sellsbrothers.com/news/showTopic.aspx?ixTopic=1995

http://support.microsoft.com/kb/919284

Related Topic