Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Duplicate items are not supported by the "Resources" parameter

Tags:

c#

resources

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

like image 733
Abdul Rahman Avatar asked Apr 08 '12 19:04

Abdul Rahman


2 Answers

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.

like image 55
Atiris Avatar answered Nov 16 '22 11:11

Atiris


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.

like image 2
Michael Avatar answered Nov 16 '22 13:11

Michael