Question

Requirements:

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

Google found these:

EDIT:

No apps please, only libraries.

Was it helpful?

Solution

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.

OTHER TIPS

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.

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top