Two output file names resolved to the same output

I am developing a .NET application for the .NET 3.5 Framework. I recently created a new form called WorkersScreen. When I try to start a project, I get this error:

Error 1 Two output file names resolved to the same output path: "obj\x86\Debug\DryWash.WorkersScreen.resources" DryWash 

What does it mean?

+60
c #
Dec 06 '12 at 8:40
source share
20 answers

This can happen if two .resx files point to the same form. Usually occurs when renaming forms (other reasons may apply, I'm not quite sure)

If your form files look like this:

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

this usually means that you renamed the form, but Visual Studio did not delete the old .resx file. Once you delete the file (in this example, MyFormerFormName.resx ) manually, the error should be deleted after the next build.

+77
Jan 28 '13 at 8:55
source share

Starting from 8/03/16 this one works for me!

First upload the project by right-clicking on your project, then click upload project .

enter image description here

Right-click on your project and click on edit project .

enter image description here

It will show you some code, look for duplicate values ​​which in my case look like

 <EmbeddedResource Include="frmTerminalSerial.resx"> <DependentUpon>frmTerminalSerial.vb</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="frmVisual.resx"> <DependentUpon>frmVisual.vb</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="frmVisual.resx"> <DependentUpon>frmVisual.vb</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="My Project\Resources.resx"> <Generator>VbMyResourcesResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.vb</LastGenOutput> <CustomToolNamespace>My.Resources</CustomToolNamespace> <SubType>Designer</SubType> </EmbeddedResource> 

Pay attention to this part, this is a duplicate !

 <EmbeddedResource Include="frmVisual.resx"> <DependentUpon>frmVisual.vb</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="frmVisual.resx"> <DependentUpon>frmVisual.vb</DependentUpon> </EmbeddedResource> 

Remove one of them so that it looks like this:

 <EmbeddedResource Include="frmTerminalSerial.resx"> <DependentUpon>frmTerminalSerial.vb</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="frmVisual.resx"> <DependentUpon>frmVisual.vb</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="My Project\Resources.resx"> <Generator>VbMyResourcesResXFileCodeGenerator</Generator> <LastGenOutput>Resources.Designer.vb</LastGenOutput> <CustomToolNamespace>My.Resources</CustomToolNamespace> <SubType>Designer</SubType> </EmbeddedResource> 

Save it, right-click on your project, then click reload project . You made!

+30
Aug 03 '16 at 7:51
source share

Usually if you create a hyphen like this

 Add-Migration "UpdateProducts" 

Visual Studio will create a migration with the class name, such as UpdateProducts. If you add a new migration later using the same migration name, it will generate a migration with the class name, for example UpdateProducts1., Automatically adding the added digit to the end as a suffix. Each time you create a new migration, the number increases by one.

In our case, for some reason, VS got confused and began to generate subsequent migrations with the same class name as the existing migration, so there were two automatically generated migrations with the same name.

Just changing the class name for the new migration fixes the problem.

+7
Aug 29 '17 at 15:51 on
source share

I did a little search I have the same problem, this is probably because your form has two .resx if you try to delete one, the problem will disappear my form:

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

i deleted Log_in.resx and my program worked again

+2
Aug 26 '14 at 10:56 on
source share

Make sure you do not have two .resx files. See in your project under YourServiceName.cs . It works for me.

+2
Sep 18 '18 at 14:25
source share

It happened to me. I accidentally "dragged" the form to another. In the end, he created a copy of "Copy." I deleted it and the problem disappeared.

+1
Jan 30 '14 at 19:17
source share

In my case, the problem was caused by the EmbeddedResource tag for the designer.resx file, which was somehow added to the .csproj file.

In particular, the following:

 <EmbeddedResource Include="Forms\frmMenu.designer.resx"> <DependentUpon>frmMenu.designer.cs</DependentUpon> </EmbeddedResource> 
+1
Nov 06 '15 at 1:48
source share

Look for the class specified in the error list in the entire project, for example, in this case DryWash.WorkersScreen it can be repeated in another file with a different file name, but inside the same class name.

+1
May 08 '17 at 9:21 a.m.
source share

I had this problem when I accidentally created a migration with the same name as the business object. The solution is to remove the hyphen, and then create a new one with a different name.

+1
Jul 16 '17 at 0:53 on
source share

This happened to me when I copied the form to reuse most of the functionality, and then renamed the form. I went to the directory I referenced, found that there was actually only one file, copied that file, renamed it to refer to the name of my new form, and then inserted the new file back into the directory.

I don't think this is a good practice (I'm new to C #), but it worked, instead of recreating everything. I also needed to update the name of the form in several places throughout the solution, which is surprising in the original form, as well as in the new form.

Copying forms does not seem like a good idea.

0
Oct 07 '14 at
source share

This happened to me when I launched the Add Migration command and gave the same name as the name of my project as the migration class. I removed all migration classes and again added a new solution assembly.

0
Jun 24 '15 at 3:43 on
source share

If this problem occurred while working with EntityFramework and tried to perform Add-Migration , the solution is simple: delete the Migrations folder (in Solution Explorer) and run Enable-Migrations . Fallback migrations if you need to.

0
Nov 17 '16 at 14:22
source share

I had a problem and this was caused by the fact that I had a partial custom element class .

I accidentally created a .resx file for partial

I think I did this by pressing shift F7 on a partial class and creating an empty designer form.

Removing the .resx file in the partial class allowed it for me. I used version control and it showed that it was a new file.

Hope this helps

0
May 03 '17 at 16:47
source share

For me, the problem was copying and pasting .aspx, rather than renaming the code behind the class files to match the name for the copied aspx file. Changed code names and class names of designers.

0
Nov 03 '17 at 14:48
source share

I had the same problem: I deleted the migration files (through the studio) after updating the database.

0
Jun 12 '19 at 18:01
source share

I just got this problem using VS 2019 Community Edition.

I did not have duplicate .resx files. I did not have duplicate .cs files. I could not find a solution on the Internet.

To fix the problem, I cleaned up the solution and then restarted VS. Not sure why, but it worked. Hope this helps.

0
Jul 30 '19 at 13:21
source share

I confirm the WimOmbelets response provided in the comments. This can happen if you rename the class to VS2012 (I never had this in a previous version).

I cannot be sure that this is the reason, but one thing that I distinguished from my usual way, I used F2 to rename it, not change it, and then press control -.

-one
Jan 28 '13 at 7:52
source share

I thought that after posting this error I would post at least one random forum in the hope of alleviating problems with elses. I searched many Google sites and I did not have my problem. My case was similar, but different in some ways.

Actually, I had a partial class distributed across several files. this class was a form class. This in itself was successful and did not cause problems. However, this led to the fact that the new class retained its unique file name, while retaining the code "form class". Most likely, this was not a kosher practice, but nevertheless it happened at that time. It seemed like a good alternative to get a lot of cluttered code. Needless to say, next time I will just use regions or another alternative.

The error occurred when I tried to take the code from the second file and copy / paste to a new file without a form with only a class, as I assumed, essentially turning it into a library and changing the code a little more correct and readable. Since I did not know exactly what caused the error when this happened, and made a small number of changes, it took some time to track. Even after changing the code, I managed to skip a couple of methods.

Basic form methods containing the Form class with initializeComponent and the form constructor (load). A second copy of these methods led to the same error. Even after removing additional code and additional form and resx files. I even tried deleting the legit resx file since it was not actively needed. I was not able to track this effectively, because any errors pointed to legitimate versions of these code segments. Ctrl + F and backups are your friends.

Hope someone help

-one
Sep 12 '14 at 4:47
source share

In my option, help remove one * .resx for each form where an error occurred

Details INFO

In our project, we have 6 * .resx for each form for localization (DE, GB, SK, RU, SRB), and if I delete (from VS) FormName.sr-Latn-CS.resx, the error disappears. If I try to remove FormName.en-GB.resx, this does not help. The error disappeared only to remove sr-Latn-CS.resx (perhaps the designer cannot solve two issues). I first saw this error when I migrated a project from VS 2010 Win 7 to VS2010 Win 10.

-one
Feb 12 '16 at 9:30
source share

I had the same problem when I renamed one of my Form classes using Ctrl + R + R , which VS provides for renaming objects by default.

Then I got a few 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 

Two Bar indicate the same resource file, which one of them should not.

This is a trivial problem, but sometimes it is difficult to find the reason, because viewing cs files simply cannot tell which one to look for.

-2
Dec 01 '15 at 8:05
source share



All Articles