Two output file names resolved to the same output

后端 未结 21 772
攒了一身酷
攒了一身酷 2020-12-13 23:50

Recently I created new Form called WorkersScreen. When I try to run the project I got this error:

Error 1 Two output file nam

相关标签:
21条回答
  • 2020-12-14 00:07

    In my option, help delete one *.resx for every form where the error raised

    Detail INFO

    In our project we have 6 *.resx for every form for localization (DE,GB,SK,RU,SRB) and if i delete (from VS) FormName.sr-Latn-CS.resx than the error disappeared. If i try deleted FormName.en-GB.resx it did not help. Error disappeared just for delete sr-Latn-CS.resx (maybe a designer can not solved two - ). I first saw this error when I migrated project from VS 2010 Win 7 to VS2010 Win 10.

    0 讨论(0)
  • 2020-12-14 00:08

    i did a little search i had the same problem it's probably beacause your form has two .resx if you try to delete one, the problem will be gone my form:

    Form1.Designer.cs
    Form1.resx
    Log_in.resx
    Form1
    

    i deleted Log_in.resx and my program worked again

    0 讨论(0)
  • 2020-12-14 00:08

    I confirm WimOmbelets answer given in the comments. This can apparently happen when you rename a class in VS2012 (I never had this in a prior version).

    I can't be sure this is the cause, but one thing I did different from my normal way is I used F2 to rename it as opposed to changing it and then pressing control-.

    0 讨论(0)
  • 2020-12-14 00:13

    I had the same issue when I renamed one of my Form classes using Ctrl + R + R which VS provides to rename things by default.

    Then I somewhat got two classes with the same class name on 2 different files (*.cs).

    class Bar { ... } // From Bar.cs
    class Bar { ... } // This should've been Foo, from Foo.cs
    

    The two Bar indicating the same resource file that one of them shouldn't.

    It's a trivial issue but sometimes could be hard to find the cause because looking at cs files just can't say which one is what you should look for.

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

    This can happen in the event of two .resx files pointing to the same form. Mostly happens when renaming forms (other reasons may apply, I'm not exactly sure)

    If your particular form files looks like this:

    Form1.cs
    Form1.designer.cs
    MyFormerFormName.resx
    Form1.resx
    

    then that usually implies that you renamed the form but Visual Studio didn't remove the old .resx file. Once you delete the file (in this example MyFormerFormName.resx) manually, the error should be gone upon next build.

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

    In my case, the issue was caused by an EmbeddedResource tag for a designer.resx file that somehow got added to the .csproj file.

    Specifically, the following:

    <EmbeddedResource Include="Forms\frmMenu.designer.resx">
          <DependentUpon>frmMenu.designer.cs</DependentUpon>
    </EmbeddedResource>
    
    0 讨论(0)
提交回复
热议问题