10

Can anyone recommend a merge tool that's specifically designed for merging C# code? The features I'm after:

  • Can identify code constructs (classes, methods, ...)
  • Can detect reorders of those constructs
  • Ignore reorder-only differences
  • 3-way merge
  • Compilation errors highlighted on-the-fly in the result pane.

Basically, I'm looking for a tool that's much more specific than classic file merge tools like Winmerge. The problem with general-purpose merge tools is that they detect changes line by line which makes it extremely hard to identify blocks of code that has been moved around but that are still perfectly valid, and more importantly, to identify compilation errors in the result.

10
  • 2
    Well, his question addresses a common problem, especially with automatic code reformatting. Highlighting of compilation errors really doesn't fit into a merge tool, but his other points are very valid. Sep 26, 2011 at 9:59
  • 11
    @MitchWheat - People probably like the idea of a context sensitive merge tool. I believe one calls it a programmer.
    – Oded
    Sep 26, 2011 at 10:00
  • 4
    @MitchWheat: Your comments are disrespectful. Automatic code reformatting doesn't only introduce white spaces. It might introduce braces, rename variables etc. See ReSharpers Clean Code feature for example. Furthermore, all this has nothing to do with a magic teapot. It can be achieved be creating a merge tool that doesn't compare characters but code entities. Sep 26, 2011 at 10:07
  • 1
    @Daniel Hilgarth: if you are using a tool (such as Resharper) to change the code, then you better not ignore those changes in a diff tool. Sep 26, 2011 at 10:09
  • 1
    @SaeedAmiri: No. Please read my comments again. The OP is asking for a tool that can compare the code entities (or code constructs as he calls them) and not the characters itself. One use case of this is to see only the real changes in a code file in which real changes have been made as well as automatic changes using a automatic code reformatter. Nobody ever talked about the merge tool doing the code reformatting - except you. Sep 26, 2011 at 10:28

1 Answer 1

5

What about Code Compare? The features you asked for are in the Pro Edition (see feature comparison) which is 49.90$.

2
  • CodeCompare looks like a good fit for the requirements listed in my question. I'm currently trialing it. Thanks.
    – Nicolas
    Sep 27, 2011 at 13:58
  • It looks good, but it is slow to work with. Also the interface is a little cluttered as there are way too many UI elements overlaid on the code. Feb 25, 2014 at 14:32

Not the answer you're looking for? Browse other questions tagged or ask your own question.