All Things Techie With Huge, Unstructured, Intuitive Leaps

Copying Forms Error in Visual Studio .Net and C#

A colleague phones me up and asks me about a Visual Studio C# project that I had written a couple of years ago.

He tried simply copying a form and he kept getting the error:

The item "obj\Release\<filename>.resources" was specified more
than once in the "Resources" parameter.  
Duplicate items are not supported by the "Resources" parameter.

Hmm.  I went to stacktrace (the website) and they said that the easiest way was to go into Explorer, duplicate the files and add them to the project.  It didn't work because the .resx file was not under the .cs file structure.

It turns out that the re-factoring isn't complete.  If you just plain old copy the form in the Solutions Explorer, rename it, and then immediately go and fix all of the references to the old name in the .cs file (rename the class, the constructor and all references to the old name) and then do the same thing in the .resx file, everything eventually works.

It eliminates the above problem.

Hope this helps someone.

No comments:

Post a Comment