Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Two output file names resolved to the same output

Tags:

c#

.net

winforms

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

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

What does it mean and how does one resolve it?

like image 415
user1613523 Avatar asked Dec 06 '12 08:12

user1613523


3 Answers

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.

like image 153
Wim Ombelets Avatar answered Nov 02 '22 11:11

Wim Ombelets


Find Duplicates by Editing Project File

  1. Note the name of the .resx failure.

  2. Unload the project first by right clicking on your project then click Unload Project.

enter image description here

  1. Right click your project again and click edit project.

enter image description here

It will show you some code, look (or Search within the file for the resx in step 1) for the duplicate values which in my case is look like this

<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>

Notice this portion, it is a duplicate!

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

Delete one of them so it will look 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 to your project then click reload project. You are done!

like image 46
Cary Bondoc Avatar answered Nov 02 '22 09:11

Cary Bondoc


Normally, if you create a migration like this

Add-Migration "UpdateProducts"

Visual Studio will create a migration with a class name like UpdateProducts. If you add a new migration later using the same migration name, it will generate a migration with a class name like UpdateProducts1., automatically adding an incremented digit to the end as a suffix. Every time you generate a new migration, the number goes up by one.

In our case, for some reason, VS got confused, and started generating subsequent migrations with the same class name as existing migration, so that that there were two auto generated migrations with the same name.

Simply changing the class name of the new migration clears the problem.

like image 7
spadelives Avatar answered Nov 02 '22 10:11

spadelives