views:

325

answers:

1

I want to create a new form that is almost a duplicate of a dialog I already have in my project. I don't want to waste time recreate most of the form scratch if I don't have to.

I copy, then paste it into my project, and rename it from Copy of Original.cs to NewItem.cs.

When I goto rebuild my solution, I get an error.

The item "obj\Debug\Control.Forms.NewUser.resources" was specified more
than once in the "Resources" parameter.  
Duplicate items are not supported by the "Resources" parameter.

What am I doing wrong? Is there a way to fix the problem?

+1  A: 

You probably have some local resource stored in a file Called Original.resx

When you copied the dialog it copied this file but did not rename it (this should not happen though). See if you have a .resx file beneath your Copy Of Original.cs in the Solution Explorer. If so rename this also.

Might be worth performing a Clean (right-click on the Project or Solution) anyway to clear out the obj and bin folders, then try a recompile.

Simon Mark Smith
the Copy Of Original.resx file did refactor it's name when I renamed the Original.cs to New.cs
Kevin
I have a few controls that i set the 'GenerateMembers' property to false, that is why it created the resx file to begin with. Inside the resx file the controls have a 'PublicKeyToken' attribute which is the same in both files. I wonder if that is the problem.
Kevin
Setting GenerateMembers propery to false should not drive the creation of a .RESX file.Check that each of your classes are correctly named in the .cs and designer.cs. I have seen before that when you make a copy of a form and go into the code to change its class name, Visual Studio re-factors all the code and changes the name of the class in the original form.cs file also (thus creating a duplicate with the new name).
Simon Mark Smith