How to solve a “duplicate items” error in the “Res

2020-04-04 08:59发布

While working on my project, I got this error:

The item "..." was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter.

(Removed the item's name, doesn't matter)

However, I do not know how to solve this. Where do I find this parameter in Visual C# Express?

6条回答
Ridiculous、
2楼-- · 2020-04-04 09:17

A slightly simpler way ..

  1. Select the form and then right-click and select "Exclude from Project".
  2. Clean and Recompile project
  3. Select the "Show all files" icon on Solution toolbar to show the excluded form files.
  4. Select the form and then right-click and select "Include in Project" to add it back.
  5. Recompile project
  6. Save All to ensure that project file is saved.

No need to restart Solution or move the form.

查看更多
我命由我不由天
3楼-- · 2020-04-04 09:17

This happen when you change name form it duplicate resources file of form.

You open old copy all items and paste to new resource then delete old res file.

Rebuild Solutions.

查看更多
\"骚年 ilove
4楼-- · 2020-04-04 09:20

I guess the item "..." is a form, then:

  1. Remove the "..." form from recent solution (and save somewhere)
  2. Recompile the project
  3. Save the solution
  4. Restart the solution
  5. Add the "..." form
  6. Recompile
查看更多
Explosion°爆炸
5楼-- · 2020-04-04 09:23

Create a backup of both the .cs and .designer.cs file which is giving the error and then delete that file from the project. Rebuild the solution and then copy back both .cs and .designer.cs files. Finally, rebuild the solution again.

查看更多
戒情不戒烟
6楼-- · 2020-04-04 09:34

I received this error after I copy and paste Form1 (for example) in my project.I rename Copy in Form2, but Form2 had next line in *.cs "public partial class Form1". As i understand after copying class name didn't change. I resolved this problem by adding a new form and copying there controls from my old form. The Old form was deleted.

查看更多
老娘就宠你
7楼-- · 2020-04-04 09:38

To fix the issue I browsed to [obj > Debug] and [obj > release] and deleted any files which referenced the word resources. After this, my project built successfully.

查看更多
登录 后发表回答