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

后端 未结 29 1407
深忆病人
深忆病人 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-05 00:04

    This just happened to me. What happened was that I duplicated a project that was originally under source control. Although I properly renamed everything, the file permissions on all the files were still set to read-only. When I started modifying some form controls, Visual Studio automatically created a Resource1 file because the original Resource file was read-only.

    What I did to fix this was as follows:

    1. allow write permissions on the project files.
    2. deleted the original Resource file
    3. Ctrl-A for all form elements, then Ctrl-X to cut them.
    4. Save the form.
    5. Ctrl-V to paste them all back.
    6. Save the form.

    I had to do this because the auto-generated code wasn't updating on it's own, so I "forced" it to update by making a change to the form. Not doing this left a bunch of code from form elements that no longer existed prior to changing the file permissions.

提交回复
热议问题