error RG1000: Unknown build error
Asked Answered
A

1

9

C:\Program Files\MSBuild\Microsoft\Silverlight for Phone\v4.0\Microsoft.Silverlight.Common.targets(625,5): error RG1000: Unknown build error, 'An item with the same key has already been added.'

Done building project "FileName.csproj" -- FAILED.

Build failed.

Receive this error whenever i try building the soln.

Anchises answered 16/9, 2011 at 14:14 Comment(2)
you might have specify the same name in XAML for different controls? check the x:Name and Name properties on your controls. This is just a guess thought.. might be something else.Bildungsroman
syntax solution would be very good in this situation because we don't know what your doing or exactly how this error is occurred.if this was not a question on this site before, most likely means this may not be an error that we have approached. So information would be wonderful!!Osber
B
19

We ran into the same problem yesterday. It happened after we merged two branches in our TFS, so we looked into the project file. There was twice the same image added to the project file. If you open that with an XML editor you could look to a part like this:

<ItemGroup>
  <Resource Include="Assets\Images\icon.png">
    <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
  </Resource>
</ItemGroup>

Removing the duplicate parts solved our problem, but is indeed hard to find this kind of duplicates. Maybe there is a more user friendly option, that I didn't find yet.

Credits to this blog-post that did a great deal in solving the issue. On my search through the internet, I also found a bug-report. Maybe it is worth looking to that.

It also looks like there are many possibilities to trigger this error. See the following questions here on Stack Overflow:

Braynard answered 8/2, 2012 at 16:33 Comment(1)
To find the duplicates: make a copy of your .csproj file, open it in Notepad++, sort linesSotted

© 2022 - 2024 — McMap. All rights reserved.