Friday, December 11, 2009

Setting up and using KDiff in Visual Studio

One of the things that really sucks when using TFS is the integrated Diff and Merge tool which it ships with. I’ve tried out a few merge tools, and the one I was using previously was pretty good (I didn’t think a merge tool could get any better), and if you decide you don’t like KDiff then I would recommend giving it a try.

http://www.sourcegear.com/diffmerge/

Anyhow, a work mate recommended KDiff, initially I didn’t like the look of it. The user interface isn’t very inviting, if anything its rather intimidating. However once you get past its initial complexity its actually very simple and easy to use. Not to mention its quite powerful, and its three way merge algorithm is even more clever than TFS (its not hard tbh).

First download and install KDiff: http://kdiff3.sourceforge.net/

Next let’s set up visual studio to use it instead of the built in one, for both diffing and merging.

Go to tools and options.

image

Then select Source Control in the left pane, followed by the Visual Studio Foundation Server child item.

image

Hit the configure User Tools button.

image

Hit the Add button, and setup your comparison tool with the following data:

Extension: .*
Operation: Compare
Command: <location>\kdiff3.exe
Arguments: %1 --fname %6 %2 --fname %7

Next setup your merging tool with the following data:

Extension: .*
Operation: Merge
Command: <location>\kdiff3.exe
Arguments: %3 --fname %8 %2 --fname %7 %1 --fname %6 -o %4

Nice, you’ve setup KDiff as your default tool! The next post will outline some useful shortcuts and features.

2 comments:

  1. Thanks for the article.
    I was able to configure it in a couple of minutes with your help.

    ReplyDelete
  2. Thanks for help. It was useful for me.

    ReplyDelete