Morgan Vergara
Morgan Vergara

Reputation: 31

Duplicate project reference entries in a .csproj file

I was recently checking in a change to a c# project and during the checkin, I had to do a manual merge on the .csproj file. While doing the merge, I noticed that there were duplicate entries for all the project references in the project.

Specifically, the ProjectReference tag was duplicated for each other project referenced in the project being merged. Like so:

<ProjectReference Include="..\..\..\DataSourceInterfaces\DataSourceInterfaces.csproj">
  <Project>{335ED423-8DC5-4D56-86D6-9A1B0F7DB0B9}</Project>
  <Name>DataSourceInterfaces</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\DataSourceInterfaces\DataSourceInterfaces.csproj">
  <Project>{335ED423-8DC5-4D56-86D6-9A1B0F7DB0B9}</Project>
  <Name>DataSourceInterfaces</Name>
</ProjectReference>

If I go into the Visual Studio UI and delete the reference to the DataSourceInterfaces project, only one of the tags is removed, and the next time I load the project, the reference shows up in the reference list as if it hadn't been removed.

This is easily fixable by manually removing the duplicate entries and doesn't seem to cause any problems, but I'm wondering what could have caused the problem in the first place.

Upvotes: 2

Views: 1599

Answers (1)

Reed Copsey
Reed Copsey

Reputation: 564451

I'm wondering what could have caused the problem in the first place.

It sounds like your merge tool failed during the manual merge, and added duplicate project references. When you merge manually, you need to take care that this type of thing doesn't happen - all it takes is a slight difference in things like indentation or whitespace changes to occasionally mess up some merging tools (this depends a lot on the tool in question, though).

Upvotes: 2

Related Questions