views:

3279

answers:

3

While working on an existing project I suddenly got the following error when trying to compile the solution:

error MSB3105: The item "[filename]" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter.

Now, as far as I'm aware, I did not make any change to the project that affects the resources. Also I have checked each and every file within the project, but there is no duplicate reference anywhere to this file. Now I already found some forum entries regarding this error:

1) Open the .csproj file and remove the duplicate reference. [Tried this, but I cannot find any duplicates in it]

2) In a 'partial class' project, move everything to a single class. [ Could try this, but the project has been split up into partial classes since the start, and I do not want to change this just because of the error ]

So what else could cause this ?

+1  A: 

Did you try showing all files in the Solution Explorer? You could have a duplicate .rsx file somewhere in there.

Theresa

Theresa
Thanks for the suggestion. But I did, and I did not find a duplicate. I also tried to find duplicate forms, for someone suggested I might have accidentally copied a form.
Cees Meijer
+1  A: 

I found the answer in .NET forum posting by Roy Green, and Theresa was right after all, though I did not recognize it.
If you have your main form class split up into partial classes, the partial sections end up in the solution explorer as separate items. And if you double click on them they show up in the designer mode as a normal form. But if you (accidentally) drop a control on these forms, Visual Studio creates a new .resx file and a InitializeComponent routine for it. But since this form is actually just part of the Main Form class it leads to the 'duplicate resources' error. And there is no other solution but to remove the InitializeComponent routine and delete the .resx file by hand.

Cees Meijer
Accept her answer then :)
Geo
You're right. I just did..
Cees Meijer
A: 

Hi, be sure that under yourForm.cs not duplicater resource are defined (.resx). If you renamed your Form, remove the old resource cause the new one during compile will be create with the new name.