8

The item obj\Debug\BookStore.MainForm.resources was specified more than once in the Resources parameter. Duplicate items are not supported by the Resources parameter.

How do I fix this?

enter image description here

Abdul Rahman Majeed
  • 1,125
  • 2
  • 10
  • 22

5 Answers5

7

This error happened when you copy and paste a form in the 'Solution Explorer' pane. Then you change name of one forms. Visual studio give the same name for both and then, when you rename form, Visual Studio do some refactoring for you and rename Designer class for both forms (not only for new).

You can fix this two ways:

  1. Close Microsoft Visual Studio, then browse to your project folder from external program (ex. Total Commander). Into the folder where both forms are defined you can see your form's .cs and .Designer.cs file. Open the .cs and .Designer.cs files for your form in a text editor. Find and replace every instance of the original form name with new name. And if you rename already rename some resources, check file for original form also (if they are only original form name but not anything for new form name). Then save all files, start Microsoft Visual Studio and rebuild your project.

  2. You can try chcek and rename declaration for each occurance of original form name in new .cs and .Designer.cs files but try disable refactoring. If you already renamed new form, in .Designer.cs for old form you maybe see this:

    namespace YourProjectNamespace
    {
      partial class NewFormName
      { .. }
    

    You must rename NewFormName to OldFormName and when Visual Studio offer you a refactoring menu (small reg rectangle before last letter of renamed object) do not make anything.

Atiris
  • 2,613
  • 2
  • 28
  • 42
2

This happened to me when I created a partial form class. When I unintentionally viewed it in Design mode it created a localized resx file for the new partial form. I deleted that resx file and that resolved it.

Michael
  • 2,825
  • 3
  • 24
  • 30
0

you cant add to the resources file 2 items with the same name/key. it has to be unique

enter image description here

Royi Namir
  • 144,742
  • 138
  • 468
  • 792
  • 1
    @Abe: you shouldn't edit answers to try to respond -- I moved your image into your question, where it makes more sense. Thanks. – sarnold Apr 09 '12 at 00:13
0

Check the *.resx files in your project as @Royi Namir described.

In case you have already done that: check your .resx.designer files. Some programs "optimize" the designer files.

The designer files are just plain xml. If they are not in sync with the corresponding xml you'll get an exception as described.

draptik
  • 470
  • 3
  • 19
0

I have same problem, and I able to resolve it by these steps:

  • Right-Click to your form name example: MainForm
  • To Review: Select Find All References now you will see the list of form of possible conflicts
  • To Fix: Select Refactor -> Rename -
  • Select Preview reference changes
  • Rename it Differently
  • Un-checked for the Conflict Form/class
dr.Crow
  • 1,493
  • 14
  • 17