error RG1000: Unknown build error

谁说胖子不能爱 提交于 2021-02-07 14:28:32

问题


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.


回答1:


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 whit 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:

  • C#: An item with the same key has already been added, when compiling expression
  • VS2010 "An item with the same key has already been added"
  • Visual Studio Error: An item with the same key has already been added


来源:https://stackoverflow.com/questions/7446037/error-rg1000-unknown-build-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!