|
Hello, 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.
|
| Chrishuang |
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
|
| Simon Dahlbacka |
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" |
| DanMoseley - MSFT |
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 yourcomputer. If you've reinstalled your OS and installed VS2008 and you can't builddue 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.
|
| Carl355 |
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
|
| Simon Dahlbacka |
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.
|
| JoelNewton |
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 |
| Mike737Aviator |
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" |
| DanMoseley - MSFT |
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 |
| Mike737Aviator |
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 oneform was renamed by a suddenly popped up dialogbox doing a refractoring process. Refractoring processes apperently can develope unexpected events.
KWHJ |
| KWHJ |
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 thata 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 |
| MFurmedge |
The 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. |
| goldsworp |
| 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. |
| DarthDemo |
You 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. |
| Jeff Hunsaker |
Just 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
|
| Pringy |
I 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. |
| Geoffrey Slinker |
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.
|
| Deeps_123 |
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. |
| Udi.._ |
I 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?
|
| Definite Reaction |
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?
|
| Wyatt Preul |
Wyatt, 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...
|
| Cosmin Lehene |
Going 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.
|
| JonOns |
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 Studiotells you what Projectis affectedin 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. ;) - Proposed As Answer byAang明明 Friday, February 20, 2009 1:22 PM
-
|
| miche1024 |
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.
|
| bmoneil |
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. |
| Matthew Wright |
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. |
| Mark Finley |
I 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. |
| Jim Jty |
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. |
| Matthew Wright |
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 thatfixed it. I guess that even though they are in seperate namespaces the comiler tries to merge them somehow.
Thanks
Ben Reese |
| Ben Reese |
I got this error when I sub-classed a class from root class.
Before
class A {} class B {}
to
After
class 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 |
| Nick Chris |
Well, 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 |
| Wilman |
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 |
| kbiesbrock |
This 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.
|
| Wompeter |
Open the resource-file and change the ">>$this.Name" to the new name. |
| balans |
I'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
|
| georgemjr |
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 whenStudio 2005copies 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.
|
| JRichTX |
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 |
| Art1984 |
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 yourcomputer. If you've reinstalled your OS and installed VS2008 and you can't builddue 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.
|
| Carl355 |
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 :-))
|
| PGMeira |
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. Sowhen 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 even3 weeks!). |
| stephengraham |
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! |
| NIKKOSTA |
Thx Joel, this solved my problem.
|
| TBone89 |
Yep, 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.
|
| KellyLeia |
While 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...."
|
| Bajare |
When copying and pasting a form, just change the namespace of the copied form, then rename the form and let the IDE do its work |
| amr_mt |
No 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 |
| Mr. Javaman |
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 |
| neomatic |
miche1024, you are great. |
| Aang明明 |
I have also had this issue, but it only happend to forms where I hadcreatedand then renamed them, thenmade design modifications. I just renamed the original designer file to match the renamed form and recompiled it. |
| CloudRunner |
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 |
| rdeforest |
I 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. |
| Stefan M |
Just finished resolving my issue. I had a similar iusse, my app would not compile having the same error: Error1 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
|
| Nicolas Rafalowski |
This 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. |
| Furb00y |
(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.
- Proposed As Answer bySMASoft Thursday, September 10, 2009 2:15 PM
-
|
| SMASoft |