Error: The type exists in both directories

前端 未结 19 1827
北恋
北恋 2020-12-14 14:13

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

相关标签:
19条回答
  • 2020-12-14 14:40

    There might be two classes with same name "Helper" in your solution/project. Change name of one of them and then rebuild

    0 讨论(0)
  • 2020-12-14 14:41

    In my case, I have to items with same name but different extensions in my project. One was accountRep.aspx and the other accountRep.rpt made by Crystal Report. Problem solved when I changed accountRep.rpt to accountReport.rpt

    0 讨论(0)
  • 2020-12-14 14:42

    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

    0 讨论(0)
  • 2020-12-14 14:43

    In my case I got this error when I had mistakenly named a class the same as the class it was inheriting from.

    0 讨论(0)
  • 2020-12-14 14:45

    Simple Solution worked 100% for me

    Put the class outside App_Code Folder

    http://vishaljoshi.blogspot.in/2009/07/appcode-folder-doesnt-work-with-web.html

    0 讨论(0)
  • 2020-12-14 14:45

    In the Web Application(not Web Site), I change App_Code*.cs Build Action(file properties) from Compile to Content. then the problem solve.

    0 讨论(0)
提交回复
热议问题