Duplicate items are not supported by the "Resources" parameter error when building project
-
13 июля 2006 г. 3:55Hello,
While building our current project using Visual studio 2005 we stumbled on this error,
===
Error 16 The item "xxx" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter
===
we traced the issue down to resource file naming convention differences between Windows Vista and Windows XP
ie, for a given form, if we include chinese traditional and chinese simplified resources,
On Vista
the resx files must be named with zh-HANS / zh-HANT , using zh-CHS/zh-CHT VS2005 will choke
On XP
the resx files must be named with zh-CHS/zh-CHT, using zh-HANS/zh-HANT VS2005 will choke
This is really causing trouble, as we develop both in XP and Vista, is there any way we can avoid this ( beside excluding the languages)
any help is greatly appreciated.
Hyt.
Все ответы
-
13 июля 2006 г. 15:26
One way that might work is to modify your project files and conditionally include the resource files e.g.
<EmbeddedResource Include="foo.zh-hans.resx" Condition="$(RunningVista)" />
<EmbeddedResource Include="foo.zh-chs.resz" Condition="$(RunningXP)" />
...
Now, here you'd have to duplicate the files, and even if you can setup the project to do it automatically for you, you'd have duplicates. And the second issue is to figure out how to set the $(RunningXXX) properties dynamically depending on OS
So, while not being an "optimal" solution, I think it should work
/Simon -
7 августа 2006 г. 15:45
This error can also occur if the contents of the \obj folder have become corrupted. I noticed project.VBProj.filelist.txt file that I was getting nested references to various files, the resources files among them.
To resolve the issue, I blew away the contents of the \obj folder and rebuilt the project. That fixed the issue.
-
31 августа 2006 г. 1:13
I got the same error, but deleting the \obj folder didn't fix it. The error reads "The item "obj\Release\ProFlyingReport.frmOptionsDialog.resources" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter."
I've tried everything I can think of, but a program that was running fine is all of a sudden broken. I can't find a way to fix it, and the error doesn't tell me where to go to "unmention" the form.
Any ideas?
Thanks,
Mike
-
31 августа 2006 г. 16:24Модератор
Mike can you reduce your problematic project down to the absolute minimum that still reproduces the problem and post back?
Chris - re zh-Hans/zh-Hant. We have discussed the fact this breaks us, with the team in Windows that made this change to culture names in Vista. The good news is that they are planning to partially revert their change in Vista. The result is MSBuild should build zh-Hant/s and zh-Chs/t just fine on Vista (and on XP, too, if you install the extra culture pack). You can use just zh-Chs/t and resources should load fine on both Vista and XP. At some future point, Chs/t will likely be deprecated for Hans/t . I don't know what public Vista build this change will be in.
Dan
"This posting provided AS-IS, with no warranties"
-
16 сентября 2006 г. 16:15
I solved the problem by backing up the offending form file, deleting it from the project, rebuilding, and then adding the form back into the project. It appears that this forced VS to rebuild the resources for the form.
Mike
- Предложено в качестве ответа SDK-Build 10 июля 2012 г. 10:52
-
3 октября 2006 г. 11:47
According to the above mentioned workaround to resolve the error "The item "obj\Debug\blabla\blabla" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter", i like to mention that at my side this error popped up due to a - from my point of view - an omission in the refractoring tool. One way or the other just one form was renamed by a suddenly popped up dialogbox doing a refractoring process. Refractoring processes apperently can develope unexpected events.
KWHJ
-
6 октября 2006 г. 10:34
I had the same error after copy-and-pasting a form and then renaming the new version, when I clicked on the 'show all files' icon in the solution explorer I noticed that a second .resx file was present under the offending form named after the original form that I had copied. I deleted this 'spare' file and the error went away.
HTH
-
22 октября 2006 г. 18:40The problem appeared for me after I tried to copy and rename a form. I had problems continually. I even recreated the new form from scratch. Everything was fine until I changed the name property of the new from. I could use any name except the one I wanted to use. That caused the error during build.
After much exploration I discovered that I had accidentally renamed one of my existing forms to match the name of the item I was trying to create (Name property, not filename of the form). I renamed the old form back to its original value, renamed my new form the way I wanted it and everything is fine now. -
26 октября 2006 г. 18:55
Mike737Aviator wrote: I solved the problem by backing up the offending form file, deleting it from the project, rebuilding, and then adding the form back into the project. It appears that this forced VS to rebuild the resources for the form.
Mike
This worked for me as well. I needed to spilt a form into two files to separate business logic from presentation logic. I created a new form and changed its code to make it a partial of my original form, but encountered the same error. Performing a backup/Delete/Add Existing... did the trick.
The only thing I find odd is that the second form file I created to hold the business logic has a designer form of its own that isn't used.
-
27 ноября 2006 г. 17:11You may have a duplicate <Compile> element for a given file within your project file. I had to edit the file in Notepad removing one of the <Compile> directives.
-
1 декабря 2006 г. 11:56Just wanted to re-iterate that deleting the \obj directory in the sub-projects worked for me when coming across these errors. I had to rebuild the solution every time i removed a directory but in the end it seemed to work.
Cheers
Pringy -
13 декабря 2006 г. 19:07I have experienced the problem as well. I have a machine running Windows Server 2003 R2 SP1 which gives the error. Windows XP machine does not give the error. I am investigating if there is a Culture Pack or something I need to install.
-
6 января 2007 г. 11:51
I am experiencing the same problem I have added a partial class into my project and it created its own .resx file when i deleted this file the problem was gone. I know this is not a valid solution because it is created by wizard as soon as someone click that diakog box if anyone could suggest me with the better solution . Any kind of help would be appreciated.
-
6 января 2007 г. 15:59
It turns out that VS2005 has a problem with copy - paste - modify of a form. It bungles the new form with this problem and also modifies the original form with the modified name.
The easiest way to get out of this is to remove the new form from the project temporarily ... fix the old form name and attempt to recompile and then re-include the new form in the project and compile again.
-
8 января 2007 г. 22:14I have also run into this problem. Wow - I am more and more stunned at what a terrible quality product VS2005 is. It boggles the mind... Who in their right mind uses tools like this?
-
10 января 2007 г. 21:23
The problem is not VS2005 it is your duplication of source files. I bet you that if you look at the file that is claiming it has duplicates and then if you search for another copy of it you will find an object with the same name in the same namespace. Now tell me, how is VS2005 responsible when you have duplicate objects at the same namespace that are not partial classes?
-
31 января 2007 г. 9:07Wyatt,
Don't get confused by the error message.
I encountered the same problem. The resx files in the App_GlobalResources it's generated by a translation tool. It works fine for 10 languages, it works if I rename it to zh-CHS, but doesn't work with zh-Hans.resx suffix and you are saying that it's a duplication problem... -
8 февраля 2007 г. 18:42Going to "Build" -> "Clean Solution" seems to do the same thing as deleting the \obj folder. I ran into the problem when copying a form and then refactoring the name. The only solution I found was to create a new form and then copy the controls / code into it.
-
9 февраля 2007 г. 23:00
That's how I fixed it when I got the same error. It took about 90 seconds to fix. Try this:
If you look in the error message, Visual Studio tells you what Project is affected in the "Project" column. Find that project's .csproj file and open it in Notepad. (Be sure to make a backup copy!) For instance, if the Project is named "Roger", then the file you are looking for will be called "Roger.csproj".
Once you've opened the file, scroll through it until you see a bunch of tags that look like this (this is one tag):
<EmbeddedResource Include="MyGreatFrm.resx">
<SubType>Designer</SubType>
<DependentUpon>MyGreatFrm.cs</DependentUpon>
</EmbeddedResource>Look for the duplicates. If there is a duplicate in there, delete it. Then rebuild and see if it works. If you deleted something you shouldn't have, at least you have a backup copy. ;)
- Предложено в качестве ответа Aang明明 20 февраля 2009 г. 13:22
-
12 февраля 2007 г. 20:38
This situation just happened to me (and that is why I have found myself here). I created the issue by doing the following:
1. Copied a form from the Solution Explorer
2. Pasted the form into the Solution Explorer
3. Clicked on the new form
4. Renamed the form
Then I started to get the error.
I found that VSIDE had renamed source forms designer.cs file and changed the name of the class (in the source code) to the new form's name (not the filename, but the reference in the source code). I edited the code myself and changed the name of the source form back.
Hope this helps.
-
1 марта 2007 г. 11:19
A piece of advice when changing the Name property on the copied form: be sure to cancel the refactoring. Otherwise it will rename both forms, and any references you have in test projects, etc. It makes a real mess.
-
8 марта 2007 г. 17:13
I have read every post in three threads on this subject. I renamed and refactored a class that creates a report. It has a design surface and therefore a res file. Initially I got the above error and the project failed to compile. I removed the offending class and the solution compiles again.
However, researching the file structure, I still find a reference to the resource file in /obj/debug. ie ...obj/debug/FinleyInfoSys.Applications.PathologyBillingSystem.UI.QuestInvoice.resources. There is no resource file at the location suggested by this file's name. There are also about four other orphans in this directory and they are recreated on every build.
I have thoroughly searched the project's csproj file for the orphans in any of the tags but to no avail.
I have deleted every unused, unnecessary file in the project directory, subdirectories and still have these orphans. Where and what pray tell, creates these .resources files? If I can correct the generation of them, the false compile error will go away.
-
9 апреля 2007 г. 23:27I received this error message and found the solution via the numerous posts on this thread. However my situation was slightly different so here it is:
I was getting ready to localize a project and I had been setting the Localizable property to true on all the forms. When you set this, it adds a .resx resource file (if one is not already there.) I ran into a partial class of a form (it being partial wasn't apparent at first) and it added a resource file when setting the localizable property.
This then caused the duplicate resource file which is the main cause of this error message. I re factored this partial form class because it didn't need to be partial and in it's own file. -
11 апреля 2007 г. 8:25
I think you'll find that all your forms are made up of two partial classes - the main class, and a Designer class. That's the way that forms are generated by Visual Studio. It helps to keep the designer generated code away from your custom code. The only reason you get duplicate resource files is because the name set against your form is the same as the name of another form in the same project. Usually the name will be the same as the file name, but if you copy/paste, you can end up with a mismatch.
-
19 апреля 2007 г. 12:47
Hi all.
This thread has led me to the solution for this error (in my curcumstances) although none of the solutions presented here fixed it directly. Heres what worked for me....
My problem was that my project contained 2 resource files both called StringResources. Thes files were in different namespaces
with different custom tool namespaces. I renamed them StringResourcesA and StringResourcesB. and that fixed it. I guess that even though they are in seperate namespaces the comiler tries to merge them somehow.
Thanks
Ben Reese
-
14 мая 2007 г. 11:17I got this error when I sub-classed a class from root class.
Before
class A {}
class B {}
to
Afterclass A {
class B {}
}
I had to manually remove from project.csproj file the lines:
Lines removed from project.csproj
<EmbeddedResource Include="B.resx">
<DependentUpon>B.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
After re-opening solution my project compiled just fine and everything worked as expected.
Niklas Lampén -
17 мая 2007 г. 18:11Well, after checking this problem out all over the web, I got back to the source code and went deeper and I realized it was my mistake. I have copied and pasted a form, so I forgot to change form names in every new file.
Partial classes names (xxx.Designer.cs) and the rest needed to be reviewed and I found the old form name in many of them.
Once I checked them all, the problem was solved and compiled smoothly.
Hope it's helpful guys
W -
28 мая 2007 г. 19:42
I got this message, too. It happened when I copied a form and renamed the file only. If you have done this, try opening the .cs file for the form you're having problems with and renaming the partial class' name and constructor method.
This worked for me, but then again, I'm quite a noob
.HTH!
-Kevin
-
11 июня 2007 г. 17:40This error occurred for me while building a windows service, and moving some class files back and forth between various projects. The project ended up getting corrupted references.
Clearing the /obj folder didn't work for me.
What did work, was selecting "View all files" in the project viewer, expanding the vb class representing the windows service, and noticing that there were two "*.designer.resx" files. I deleted the one with the incorrect name ("service1.resx", vs. "MyClassName.resx") and everything was great afterwards. -
19 июня 2007 г. 9:04Open the resource-file and change the ">>$this.Name" to the new name.
-
14 июля 2007 г. 16:42I've just run across this error. I'm just learning VB and am following the Sam's "Teach Yourself..." book.
I reopened an already-built project from the other day, added a couple of buttons to the form, and tried to run the project. The subject error appeared.
From a skimming of this thread, I decided to just delete the project and start over. When I clicked on New Project, I got the templates for a C++ project. That's when I remembered I had been fooling around with C++ yesterday.
So I'm wondering if I got the error because Visual Studio was opened in "C++ mode" and I was trying to build a VB project...
GeorgeM -
24 июля 2007 г. 8:56
This seems to occur when you copy an existing form/user control/etc and then paste it back into the project. If you open the "new" copy, you will see that it's class name is the same as the original. This is the source of the problem. Apparently when Studio 2005 copies and pastes a form, it changes the Solution Explorer label, but not the new form's class declaration.
For example, suppose you have MyForm and using the clipboard, copy and paste it back into your project. The solution explorer will show the "new" form to be named "Copy of MyForm". BUT, open the form's cs file and its designer.cs file and look at the class declaration. You will see that the new "Copy of MyForm" version is declared as class MyForm in both the cs and designer.cs files.
To fix, change the class declarations in Copy of MyForm.cs and Copy of MyForm.designer.cs from
public class MyForm
to
public class Copy of MyForm.
I think this will take care of it.
-
24 июля 2007 г. 15:43
Encountered this message after copying and pasting the contents of one UserControl into another (I was reusing a number of custom controls and thought that this shortcut would work). I first renamed the namespace of the source files for the offending class. This worked. But this only helped me to isolate the problem. I had to recreate the new user control the old fashioned way, using drag and drop from the tool box.
In my scenario, I could not find any duplicates in the project file, resx files, source files etc. I have no idea where the actual duplication occurred.
Thanks for this post, it really helped me solve this very confusing bug.
Art
-
26 декабря 2007 г. 4:38
We have encountered this same duplicate resource problem several times. From reading through this post and from other information there seems to be several reasons why this message can occur.
1. You could actually have a duplicate resource entry in your project file.
2. Your obj files could have become corrupt, you need to clear out your obj files (although I haven't seen this problem for a while in my team - it might be fixed in 2008).
3. If you are using a custom culture, perhaps with the .Net RegisterCulture method, ensure that the culture has been registered on your computer. If you've reinstalled your OS and installed VS2008 and you can't build due to this problem it could be because you need to register your custom cultures before you build. This error seems to be thrown when msbuild cannot find the culture.
Good luck.
-
16 января 2008 г. 18:21
action:
select a form
copy
past
edit new form
change property (Name) to new name
problem:
C#2008 makes a QuickReplace of the old name
Changes the new files and the original files
This is not a programmers error
This is a bug in the scope of the replace code
C#2005 give a warning message
C#2008 Express just do it
Solution until the bug is fix: edit the new files by hand :-))
-
25 марта 2008 г. 15:20
I have experienced same issue, but under different circumstances which others may find useful.
Just spent 3 hours attempting to set the DoubleBuffered property on three forms and two user controls...
Screens were taking some time to appear so thought I would try setting DoubleBuffered = True for each form and user control. This caused the creation of a resource file for each form and control, although as far as I can tell these files are pretty much empty. The problem occurred because the two user controls, although located in different namespaces, have identical names. So when DoubleBuffered = False project compiles, but when DoubleBuffered = True, two resx files are created with same name, and although in different locations, cause the "Duplicate items..." error.
Having read this thread, the cause of the problem finally dawned on me...
Not sure how the user controls came to have identical names, may have been a corruption by the IDE. Needless to say, without these forums 3 hours could easily have turned into 3 days (or even 3 weeks!).
-
3 апреля 2008 г. 16:06
Well the problem in my form was that I had two resx! I've fix this just deleting the useless one.
it's seems that if you've a form divided into different partial class you should do Design Time activities just in the main file!!
otherwise the IDE will add a new resx file to the partial file!
-
7 апреля 2008 г. 1:05Thx Joel, this solved my problem.
-
27 мая 2008 г. 20:07Yep, totally was this for me. I renamed the main form when I started the project, but for some reason three days later it decided it wanted to put form1.resx back in. I deleted the original form1.resx and the error went away.
-
10 декабря 2008 г. 9:16While reaming a Form, VS 2008 renames all the references to that form. e.g. if we copy ABC form and paste it and then rename the new class(form) as PQR, this will change also change class(form) ABC to PQR.
Hence it gives the error as "Duplicate items are not supported...." -
11 января 2009 г. 10:50When copying and pasting a form, just change the namespace of the copied form, then rename the form and let the IDE do its work
-
10 февраля 2009 г. 17:40No matter how you look at this issue, it is a MS problem. Why? Because the error message doesn't tell the user what to do and what the real problem is... It does get close however and it does (as this post states, in my case) has something to do with a form being copied from one location to the other. For me the solustion was to find the form that had the resource name called out in the error. I looked for multiple RESX and could not find it. So I just deleted those forms and guess what.......Everything worked. So thanks for all the Posts, but really should the error message have "clued us in" a bit more????
Javaman -
10 февраля 2009 г. 18:07Mike737Aviator said:
I solved the problem by backing up the offending form file, deleting it from the project, rebuilding, and then adding the form back into the project. It appears that this forced VS to rebuild the resources for the form.
Mike
Hey Mike...Your solution worked!! I tried removing the obj folder, but that didnt work for me...but simply removing and readding the form worked for me..Thank you.
Joel -
20 февраля 2009 г. 13:22miche1024, you are great.
-
12 марта 2009 г. 12:41I have also had this issue, but it only happend to forms where I had created and then renamed them, then made design modifications. I just renamed the original designer file to match the renamed form and recompiled it.
-
27 мая 2009 г. 20:41
I resolved this after searching for the the named item in the code. I found that there were multiple test classes with identical names. I renamed, and in some cases removed, the class from the code behind.
-- Randy DeForest
http://cycogeek.fiesta25.com -
10 июля 2009 г. 22:37I have been struggling with a similar issue all afternoon while attempting to fix a migration from a .NET 1.1/VS2003 project to .NET 3.5/VS2008.
I wasn't able to find anything in the web project that met this issue, but after completely shutting down VS and reloading the project, I got a new warning: circular reference.
I'm not sure how the circular reference first appeared (it could very likely have been me and VS didn't warn me), but I had two projects both using one another as a reference.
Removing the unnecessary reference made this error go away for me. -
2 августа 2009 г. 14:40Just finished resolving my issue.
I had a similar iusse, my app would not compile having the same error:
Error 1 The item "xxx" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter
It happens after i reuse one form (copy paste) in my project, and chage the class name.
My problem was that i left the class name the same in the DEBUG block like this:
#if
DEBUG
public class CommentForm : UserControl
#else
public class CommentFormV2 : System.Windows.Forms.Form
#endif
changing the grayed code solved my proble.
Hope i cloud help someone -
22 августа 2009 г. 23:08This happened to my after renamed a form.
To solve this problem you just have to look in the forms you have and see if one of them has more than one .resx file. I just had to delete the one with the old name of the form and the problem was solved.
Hope that helps. -
10 сентября 2009 г. 14:14
(WinForms) This happens to me when I copy and paste a form in the project. If you go to the pasted form and then to properties, when you change the NAME property (which you MUST do), a dialog pops up saying "Your project or one of its dependencies do not currently build. References may not be updated".
SOLUTION: Hit CANCEL on this dialog and you will be fine.
Way to go Microsoft.- Предложено в качестве ответа SMASoft 10 сентября 2009 г. 14:15
-
10 ноября 2009 г. 7:47I faced the same issue while copying a crystal report file into my solution. Visual Studio automatically generates a .cs for your reports file when you copy any .rpt file regardless of whether tha attached .cs file already exists or not. So if you are copying the attached .cs file with your report it might cause this duplication issue.
-
3 декабря 2009 г. 21:23Ok here's a new one...
For the past three months no problems with my Project until today. Compiling today gives me "The item "xxx" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter"
I tried looking for duplicate items in Proj files, not there.
I looked for mulitple form names, not there.
I scanned the entire project directory for files containing the name of "xxx" as spelled out in compile error. Only found 1 hit in PROJ file but it DID NOT HAVE TWO values in it.
So I tried this: I went to the project and found the form with the name "xxx" and I renamed it to "xxx2" recompiled and got same message calling out a problem with "xxx2". Aha!
Then I went and found all references to "xxx2" in the project, and found a partial class of xxx2 which had worked forever. But thought to change it's name and manually edited the class name to reflect the file name. Recompiled and DID NOT HAVE THE ERROR.
Conclusion for me was that a partial class of mine was somehow causing the problem. Yes it had the same name as the Form which is also a partial class vis-a-vis the designer generated code.
Conclusion: I took all my code out of the partial and put it into the original FORM (which was also a partial), deleted the file from the project (from where I cut the code out). Renamed my Form to what it was originally was and made sure all references were renamed as well.
Project compiled....
THIS IS A STUPID ERROR WITH INADEQUATE INFORMATION TO DEBUG ROOT CAUSE... MSFT SHOULD FIX THIS...
Javaman -
15 декабря 2009 г. 10:50Like Javaman said:
...
Yep, I too have killed my solution (and got the same error) ... inadequate information to debug(NO ONLINE HELP ON ERROR AS WELL) ... And all I wanted to do was to COPY and PASTE a FORM (And frankly that was all I did ... Copied a form and pasted it and it killed my solution!!)
THIS IS A STUPID ERROR WITH INADEQUATE INFORMATION TO DEBUG ROOT CAUSE... MSFT SHOULD FIX THIS...
Javaman
PS - Anywho, if the product (VS) we have purchased has an option to copy a form ... and to paste it ... erm then shouldn't this product be able to do this?? Without killing your solution??
So what I am saying is: I spent +-7 @#$% extra hours fiddling with my files, searching on what may have caused this problem and frankly all due to a product that has a function to do this but that can't. (Does this count as deception from the software manufacturer? Can I ask for compensation for my time wasted?)
(This ERROR will also occur if you have the same class names on different forms ... also if you really have more than one resource with the same name)
MY WORK AROUND SOLUTION (That would have saved me time and $$)
1. CREATE A FORM FROM SCRATCH AND NAME IT TO THE NAME YOU WANT
2. COPY THE CODE (FROM THE FORM YOU WANT TO COPY) AND PASTE IT OVER THE CODE IN YOUR NEW FORM
3. IF YOU HAVE DESIGNER CLASSES THEN COPY THIS CODE OVER TOO (AND IF YOU HAVE A RESOURCE FILE COPY THE CODE CONTENTS(XML FORMAT) OVER TOO) (You can see the code and change the code by choosing the view code on the files)
4. RENAME YOUR CLASS' NAMES TO ANOTHER NAME THAN THE ONE ON YOUR MASTER FORM
i.e.
public class frmUsersWizard
to
public class frmUsersWizard2
NB: Oh! remember to rename the constructor's name as well
AND IT WILL COMPILE WITH A COPY OF THE FORM
MORE RISKY SOLUTION: Copy and paste the form. Rename the form (But like I have learnt from above posts is that the automatic refactoring when renaming can kill as well and rename all else in your solution thus referencing?? the wrong form) and then change the class names like in my solution #4.
So in short: When you want something done(and do not want to doubt in the quality) , DO IT YOURSELF ESPECIALLY IF YOU WANT TO COPY A FORM!!!
My 2cents
Soul-heart -
18 декабря 2009 г. 22:15or 4. You have two partial classes with the same name in the same namespace in diferent class files.
-
14 января 2010 г. 20:53I ran into the same error. I'm fairly certain that it was caused by inserting #if debug code into a form designer.
Solution was to:
- remove the conditional code from the form
- exclude the form from the project
- close VS
- edit the project file in Wordpad to remove any references to that form
(the file referenced in the error message showed up even though the form had been removed)
- open the project in VS
- add the existing form (without the conditional code)
- compile and run
It was several steps but it only took a minute or two. Editing the project file isn't difficult, just be sure to remove the entire element (from '<EmbeddedResource...' to '</EmbeddedResource>'.)
Hope this helps. -
25 марта 2010 г. 15:50
For me, the issue occurred when copying and pasting a UserControl through the SolutionExplorer.
More specifically, the issue was that pasting/renaming a form through the solution explorer does not update the class name or constructor in the code. To fix the issue, I needed to manually rename the class name and constructor(s) for the pasted class' code. If it has any .Designer files, these need to be changed as well.
Also, be wary of using any "Rename" refactoring tools, as mine were actually changing both the original and the pasted classes. That was the major time-sink for me. I thought I was renaming the pasted file, but I was really renaming both files to the new name (Thus continuing to have the problem).
-
29 марта 2010 г. 7:32
Got the same issue and i still don't know exactly how it hapened but i added a new form to the solution, renamed it dglSomething and
*!*!*!BOOM !*!*!* -----> mushroomcloud
The end of the world ! (Note: i figured that the renaming did create the bug. When i actually tried to solve it i had no idea) I then got the error with that exact discription.I went through the entire project trying to find any duplicate of that "dlgSomething" aaaaand nothing there. Deleted obj directorty and still nothing, checked project file ... sitll nothing. At the end, and by pure and utter chance, i accidently stumbled uppon a Form1 entry in the .proj file.. and i thought mhhhh.... i have no form called form1 anymore why is it there.... let's delete it.
And ghosh it works! the world remade it's self.
Sooo... As i read the entire thread and many, many other threads at other forums i conclude that if you get this error, you renamed somthing and since renaming stuff is obviously very hard in windows, and have fun finding it becouse the name you get in the errormessage doesn't actually have anything to do with it.
Now i wonder how errormessages are genereted in visual studio, realy i mean "HUH???"
Try For Each RenamedForm in Victims.Forms Throw New System.UnrelatedException(_ "Please spend one entire day searching for something with_ a name that is unrelated in every way") Catch ex as Exception MsgBox(ex.message, vbCritical, "GNAR GNAR GNAR!") End TryAh well problem solved, and i still have a lot of respect left for the programmers of VS and Windows :)- Предложено в качестве ответа HamishAhern 17 апреля 2011 г. 8:04
-
16 апреля 2010 г. 17:39I encountered this error by inserting an existing form into a project, then renaming it without the extension. It was corrected by re-adding the project and re-naming it correctly.
-
9 июля 2010 г. 2:13
I also encounter this problem, below is my solution for your reference.
How's occur:
1. Copy and paste a form (assume named "frmA.cs") within same solution
2. Then i renamed the copied form (will named "copy of frmA.cs") to frmB.cs
3. After, i compile the solution and show the "Duplicate items are not supported by the "Resources" parameter" error
Symptom:
When i exclude the "frmB.cs" by right click and choose "Exclude From Project", then it compile success.
I found that although i rename the form from "frmA.cs" to "frmB.cs", but in code file (right click "frmB.cs" --> view code), the partial class also named "frmA". I change the class name and the constructor to "frmB", then solved.
the partial class like below:
------------------------------------------------------------------------------------------------
using System.Data;
using System.Drawing;
using ......
...
...
namespace SolutionName
{
public partial class frmA : Form //<--------------------- partial class here, rename the frmA to frmB
{
public frmA() //<--------------------- constructor here, rename the frmA to frmB
{
}
//your code or method in here
}
}
------------------------------------------------------------------------------------------------
hope it help!!!
mc
- Предложено в качестве ответа TINY-MC-SE 10 июля 2010 г. 19:40
-
9 июля 2010 г. 14:16
Yes this is what I discovered too in my last post above:
Then I went and found all references to "xxx2" in the project, and found a partial class of xxx2 which had worked forever. But thought to change it's name and manually edited the class name to reflect the file name. Recompiled and DID NOT HAVE THE ERROR."
Javaman -
10 июля 2010 г. 9:00
salam!
how i remove this error?
-
10 июля 2010 г. 19:47
hi Qamar,
Are u encounter this error after copy a form and rename it???
-
18 октября 2010 г. 21:03
When I got this problem it was after I had created a custom UI control and then created a copy of it within the same project. Even though the new control was renamed, the error came up. I tried cleaning the project and solution and manually blowing away the obj and bin folders, but nothing worked until I exculded the copy of the control. If you (or anyone else who stumbles upon this) did something similar and got the error, try starting from scratch with a control and copying its members over instead.
--Ted
-
18 февраля 2011 г. 9:05
Error 1 The item "obj\x86\Debug\namespace_.applicaiton_.resources" was specified more than once in the "Resources" parameter. Duplicate items are not supported by the "Resources" parameter.
Answer
Go To Solution Explorer Than Delete All .resx file From the project , and rebuild the solution .......its working.....
Please make a backup before doing this... i m sure it will work......
- Предложено в качестве ответа amitkumarjain 18 февраля 2011 г. 9:06
-
17 апреля 2011 г. 7:55
Why doesn't the 7 voted item make it to the top of this thread!? it has 7 votes, like youtube, you want to see the most voted item. Microsoft MVPs always mark the useless answers.. its so annoying.
Yeah microsoft has screwed up vs2010... renaming a form fully kills you... MS fire your QA Testers.. this is ridiculous.
solution:
delete all .resx filesthen open .vbproj file in text editor and remove the resx files (include the xml tags for it also), and rebuild.
-
28 апреля 2011 г. 8:24i got same problem due to i copied form to test, i deleted that new form & everything ok already
-
25 мая 2011 г. 21:46Yes, same here. I tried a number of things that I found in this thread, and it turned out that the class names and method names needed to be renamed in a form that I had copied. That said, the reported error had absolutely nothing to do with what was really wrong.
-
15 февраля 2012 г. 6:21
Mike,
If you have another form that you backed from, then this solution won't work because the duplication still there.
I backing up the offending form, in each of the form, code, designer file I had to replace the "Original" form name (it is CLASS name actually), then I added the form back to my project then it working now.
Charles
-
1 марта 2012 г. 19:28
I am using Visual Studio 2010 and I ran into this same issue. I believe this was caused when I was adjusting the max size properties of the form and the resource file got duplicated. This is much easier to solve than what is said:
Step 1: Show all files in the Solution Explorer
Step 2: Expand the form which is referenced in the error message.
Step 3: You will see to resource files (*.resx) in the list. You are going to have to delete one of them. I navigated to the project and deleted the newest version, but it's up to you.
Now, just rebuild and the error will no longer occur.
- Предложено в качестве ответа C Rogala 1 марта 2012 г. 19:28
-
1 мая 2012 г. 17:58
VS2008, VB, and the same problem. This is how I incurred for the problem (solution more below) :
Copied a Form in Solution Explorer to use as a base for a similar one. That became "Copy of MyOldForm.vb". Renamed it to "MyForm.vb". Worked on it for several days ...
The last thing I did yesterday was copy paste a few controls of the main form of the application to this new form. They do use images in the resource file in there, and I was actually surprised it worked.
Today added a new control to the new form, and there it all stopped working. Deleting the supposedly offending controls did not help. Nothing did, and finding the bespoken double entries etc. - nowhere.
Showing the culprit was easy to repeat as I could restore a backup of the still working project easily; just touching the designer with anything was enough to let it happen.
Between yesterday and today there was a reboot (may that be important).In the Solution Explorer no .resx or other resource-like files were to be seen (except for the images themselves under Resources);
In the project's folder I found "Copy of MyOlfForm.Designer.vb" and "Copy of MyOldForm.Resx". I renamed those to the "MyForm" version, but now the files couldn't be found by VS. Btw, I textsearched the whole solution for references to them (nowhere). I noticed that the new form could now explode in the treeview for these two additionally renamed files, while all of my other forms do not allow for that.My solution - not wanting to start all over with the form - was to rename it in Solution Explorer the other way around. So, renamed back the two beforementioned files to their "Copy of" instances in the project folder, and in Solution Explorer renamed the "MyForm.vb" to "Copy of MyForm.vb" as how VS originally created it.
That did the job, and my form wil be named forver like this.
:-)HTH someone,
Peter -
8 мая 2012 г. 8:43
I am also face such a problem due to the duplicate resources...i Accidentally created the copy of one more form and .resx files its causes problem.just delete it..or go to the
Project Tab-Your Proj properties check resources...
HOPE IT WILL WORK..Thanks Guys
- Предложено в качестве ответа OhmPrakash 8 мая 2012 г. 8:43
-
8 мая 2012 г. 8:44
I am also face such a problem due to the duplicate resources...i Accidentally created the copy of one more form and .resx files its causes problem.just delete it..or go to the
"Project Tab-Your Proj properties check resources..."
HOPE IT WILL WORK..Thanks Guys
-
25 июня 2012 г. 21:45
Quick solution:
1. Line 1 of your .aspx file, change "Inherits =MyFilename" to "Ihherits = MyNewFileName"
2. In the .aspx.cs file, change "public partial class MyFilename" to "public partial class MyNewFileName"
That's it.
"He blew his mind out in a car"
-
10 июля 2012 г. 10:55I tried other suggestions but Mike your solution worked for me its simple....just deleted problem form and added back the form back into the project by which VS rebuilds the resource for the form. I think the .resx file which is the problem but removing only resx file didn't solved the problem for me.
-
10 июля 2012 г. 15:45
That's how I fixed it when I got the same error. It took about 90 seconds to fix. Try this:
If you look in the error message, Visual Studio tells you what Project is affected in the "Project" column. Find that project's .csproj file and open it in Notepad. (Be sure to make a backup copy!) For instance, if the Project is named "Roger", then the file you are looking for will be called "Roger.csproj".
Once you've opened the file, scroll through it until you see a bunch of tags that look like this (this is one tag):
<EmbeddedResource Include="MyGreatFrm.resx">
<SubType>Designer</SubType>
<DependentUpon>MyGreatFrm.cs</DependentUpon>
</EmbeddedResource>Look for the duplicates. If there is a duplicate in there, delete it. Then rebuild and see if it works. If you deleted something you shouldn't have, at least you have a backup copy. ;)
Thats works for me!
In my case, correctly appears two lines about the same file RESX, only i removed the unnecessary Entry and voilá!!!
Non Scripted Human
-
9 августа 2012 г. 18:54The same thing happened to me. Your solution didn't work in my case. I had to create new form, move the code from the old form into it, and update any code referencing the other form. I think this bug has been around for a long time now..
-
21 ноября 2012 г. 21:40This also worked for me. I created a new form in the project, copy-pasted all the controls from the old form to the new form, copy-pasted all the code from the old to the new, saved the project, and then deleted the old form. The error went away.
Price Brattin, SQLServer & SharePoint 2010 MCP, Microsoft Dynamics SL Consultant
-
23 ноября 2012 г. 7:13
Solution:-
- Renaming the form name in the solution explorer.
- Change the class name in the .cs and Designer.cs file.
- Change the constructor and destructor name (which is same as class name)
- Change the name space name (if needed).
Issue will be fixed. No need to create a new form. We can always use the existing form by doing this way.
- Предложено в качестве ответа vksvvs2000 23 ноября 2012 г. 7:13
-
18 февраля 2013 г. 11:42I happened to have a similar experience; I created a duplicate of a form and renamed the new one, and there was an error after i ran the project. After trying to solve this in several other ways, finally I just went to the "class View" tab and i saw the name of the form that was presenting errors even though i had deleted it from both the obj/Debug and the project folders. I just right-clicked it and selected the "Go to definition" option. What i found was that, Another form was still referencing that form's constructor and that any time i ran the project, the form was still called behind the scenes though it wasn't showing. I just renamed the constructor and the namespace of the new form and everything was just fine again. i hope this helps.

