Any decent text diff/merge engine for .NET?

.NetMergeDiff

.Net Problem Overview


Requirements:

  • free, preferably open-source
  • implemented in one of the .NET managed langs

Google found these:

EDIT:

No apps please, only libraries.

.Net Solutions


Solution 1 - .Net

You can grab the COM component that uses Google's Diff/Patch/Match. It works from .NET.

Update, 2010 Oct 17: The Google Diff/Patch/Merge code has been ported to C#. The COM component still works, but if you're coming from .NET, you'll wanna use the .NET port directly.

Solution 2 - .Net

I think the "Generic - Reusable Diff Algorithm in C#" on Codeproject is the best you can find as a .NET-Engine for diff/patch/merge. I made a project on my own with it and it fits my needs with most scenarios. There are one or two worst-case scencario when the algorithm made the patch-file larger than it have to be. But in most of the cases it works just fine for me (textfiles with a size of >30 MB).

I'm currently testing another Codeproject-Project you can find here: http://www.codeproject.com/KB/applications/patch.aspx It's using some DLLs from Microsoft for patching, so it looks interesting. But those DLLs are unmanaged and this project is only some sort of wrapper for it. But maybe it can help you

Edit: Just found another project, DiffPlex: http://diffplex.codeplex.com/ It's a combination of a .NET Diffing Library with both a Silverlight and HTML diff viewer. As stated there, DiffPlex is the library that CodePlex leverages to generate the diffs of files.

Solution 3 - .Net

GitSharp includes a diff engine based on meyers diff. Take a look at the demo which implements a simple wpf diff viewer based on the Diff.Sections collection: http://www.eqqon.com/index.php/GitSharp#GitSharp.Demo

Solution 4 - .Net

None of the answers so far (except possibly the GitSharp reference) deal with 3-way merge, so in case it helps anyone I recently ported Tony Garnock-Jones' javascript diff3 implementation (from the synchrotron project, based on Hunt and McIlroy 1976) to C#.

It's a simplistic single-file port of diff and three-way merge methods, but it's the standard algorithm and so far works very well for me: https://gist.github.com/2633407

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionakuView Question on Stackoverflow
Solution 1 - .NetCheesoView Answer on Stackoverflow
Solution 2 - .NetAnheledirView Answer on Stackoverflow
Solution 3 - .NethenonView Answer on Stackoverflow
Solution 4 - .NetTaoView Answer on Stackoverflow