1

We are using TF Service. As per best practices, we perform frequent merges.

The merge tool does a bad job handling merges for our project files. We get duplicates for Views, Controllers, even our PublishProfiles Folder.

I have a hard time believing that TFS hasn't been optimized to deal with something as trivial as dupes. The logic within our controllers, EDMX files, and Views should be more complex to merge, yet are handled better.

Are we doing something wrong? More specifically, is there an option or setting for TFS that better deals with such issues.

Dave Alperovich
  • 32,320
  • 8
  • 79
  • 101
  • What do your `.xxproj` files look like? If people are rearranging the contents of the file from the common ancestor then you would end up with the same line(s) or section(s) twice. – Edward Thomson Jan 07 '13 at 17:05
  • Edward, I misunderstood your comment at first. Yes, on merge, we notice that the .csproj files do get re-sorted. I'm not sure why that happens. We usually just add a few files. No major restructuring. Is there is a best practice to avoid that happening? – Dave Alperovich Jan 07 '13 at 17:33
  • Which version of Visual Studio are you using? Visual Studio 2012 (and its new Merge tool) now has support for XML contextual merging, which should make this a lot simpler... – jessehouwing Jan 07 '13 at 18:20
  • using 2012. and in this case, the xml contextual merge CREATED our nightmare. The problem definitely has roots in a resorting. But I'm not sure why or how to avoid. – Dave Alperovich Jan 07 '13 at 18:31
  • @DaveA: I'm afraid I'm not sure either, I really just wanted to ensure that the automerge was working correctly. (Even if it's producing behavior that's not correct here.) – Edward Thomson Jan 07 '13 at 18:59
  • Automerge works very well in most cases. Project files specifically give us trouble. Not always, but seriously at times. – Dave Alperovich Jan 07 '13 at 20:10
  • 1
    There's a uservoice request to improve xml/sln file merging in TFS [here](http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/2207033-implement-a-more-intelligent-merge-for-xml-files-). – DaveShaw Jan 07 '13 at 20:17

2 Answers2

2

This is a known issue with the not so good Merge tool that accompanies Visual Studio 2010 and this Visual Studio 2012 has a completely renewed merge tool that can do contextual merges between XML files, which greatly reduces the chance of these types of issues cropping up. Since you're seeing this in Visual Studio 2012, I'd love to see a couple of examples that go wrong. I haven't had major issues since upgrading to Visual Studio 2012.

As a best practice, I tend to always do a Get-Latest before adding new files. And I always check in as soon as possible after getting the solution to compile again. This reduces the chances of these issues when you're working on the same branch. You might still end up with these types of issues when doing a merge between two branches though.

Additionally, instead of using the Visual Studio 2012 merge tool for all file types, you can set a custom merge tool for specific file extensions, that way you can use any commercial or open source merge tool instead of the default one. There's quite a few great examples out there:

Your mileage may vary between the different tools out there.

Community
  • 1
  • 1
jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • Jesse this is great information. Which tool would you recommend? I've had experience with Tortoise (git) and wasn't impressed. Though it may have improved over time. Thanks again! – Dave Alperovich Jan 07 '13 at 20:08
  • I personally use KDiff a lot for VS2010. Altova DiffDog is also great, but expensive... – jessehouwing Jan 07 '13 at 20:11
0

In a team of only 3 developers this issue affects us badly with VS2013 and TFS2013. The best recourse I could find was to disable automatic conflict resolution in the settings menu. http://donovanbrown.com/post/I-dont-trust-2012-Auto-merge-but-it-does-it-automatically-.aspx

Russell Horwood
  • 1,015
  • 1
  • 11
  • 19