How To Delete Duplicate Resources

Well, I guess I wasn’t paying attention when I added an image to my solution that had the same name, but different file extension, to an existing image. Of course, Visual Studio gives the image a default name equal to the file name without extension, but doesn’t bother checking for duplicates names before adding it. Only after it is added does it bother checking, at which point it gives a rather pointless error message:

duplicate_resource

 

“There is already another resource with the name,,,” isn’t very helpful when there is no offer of a solution to the problem ! You can no longer access the resources in the normal way and hence can’t delete the offending duplicate.

You need to open your application’s resources.resx directly as text, then search through all the sections that begin  “<data name=” and delete the duplicate – with luck it will be the one most recently added and appear towards the end of the file.

resxJust delete the offending <data> section (s).

Leave a Reply