How to fix “namespace x already contains a definition for x” error? Happened after converting to VS2010

后端 未结 29 1480
深忆病人
深忆病人 2020-12-04 23:10

Specifically the error occurs in the Resources.Designer.cs:

Error 2 The namespace \'ModulusFE\' already contains a definition for \'Sto

29条回答
  •  北荒
    北荒 (楼主)
    2020-12-04 23:41

    Unfortunately, none of the other answers helped. My problem specifically occurred in a WPF project.

    The problem arose when I created a folder under the MainWindow folder, which effectively created a namespace something like ProjectName.MainWindow.Folder. Now, I believe because of some static designer code, Visual studio gets confused between the class MainWindow and the namespace Project.MainWindow.Folder . As a solution, I moved the Folder out of MainWindow. Looking at the Class View or the solution/project helps to recognize what namespaces and classes within them exist.

提交回复
热议问题