Replace diff/merge tool in Visual Studio Team System with WinMerge

I have been using Visual Studio Team System 2008 for a while now and am really starting to like the tightly integrated source control and work item functionality. One thing I cannot get used to is the basic diff/merge tool.

Where is the detail ?

The screenshot below demonstrates the basic nature of the diff tool built into Visual Studio Team System. There is no indication of the number of differences between the files being diff’ed or even the actual differences on a particular line …Visual Studio Team System Default Diff Tool

WinMerge

There is an alternative and it is both open source and free ! From the WinMerge site:

WinMerge is an Open Source differencing and merging tool for Windows. WinMerge can compare both folders and files, presenting differences in a visual text format that is easy to understand and handle.

Download WinMerge and install it.

Configure Visual Studio

Open Source Control > Visual Studio Team Foundation under the Tools > Options menu in Visual Studio.

Tools > Options > Source Control > Visual Studio Team Foundation

Click on Configure User Tools … and the Configure User Tools dialog will become available.

Configure User Tools ...

Add the WinMerge details for the Compare Tool. Click on the Add … button on the Configure User Tools dialog and configure as per the screenshot below. The arrow button next to the arguments text box exposes details about the information that Visual Studio can provide the tool being configured.

The configured arguments below are:
/e /u /wl /wr /dl %6 /dr %7 %1 %2

Configure Tool for Compare Operation

Add the WinMerge details for the Merge Tool. Click on the Add … button on the Configure User Tools dialog and configure as per the screenshot below. The arrow button next to the arguments text box exposes details about the information that Visual Studio can provide the tool being configured.

The configured arguments below are:
/e /u /wl /dl %6 /dr %7 %1 %2 %4

Configure Tool for Merge Operation

The Compare and Merge Operations should now be configured to use WinMerge.

Configured User Tools

WinMerge Command Line Options

WinMerge contains a number of command line options. The following are the ones used in the configuration above.

/e Enables WinMerge to be closed with a single Esc key press.
/u Prevents WinMerge from adding either the left or right hand side  file path to the Most Recently Used (MRU) list.
/wl Opens left hand side as read-only.
/wr Opens right hand side as read-only.
/dl Description for left hand side title bar.
/dr Description for right hand side title bar.

Finally a decent diff !

Now a Compare in Visual Studio is more meaningful, It shows the number of differences, their positions within the compared files and actual differences per line. WinMerge supports custom syntax colouring and diff colouring.

Visual Studio Team System with WinMerge

About these ads

29 thoughts on “Replace diff/merge tool in Visual Studio Team System with WinMerge

  1. With the risk of sounding incredibly lazy; it would be nice if the command line options you used were presented as selectable text.

    • I’m always willing to make the information in a post easier to use. I’ve updated the post to include the WinMerge arguments as selectable text.

  2. Pingback: Friends Don't Let Friends Use VS Merge Tool - Andreas Zenker

  3. Me and my team mates echo everyone’s replies here. We are very thankful for this post. WinMerge is definitely a much superior tool than the one VS includes, and this post makes it very easy to integrate it in VS.

    Thanks again.

  4. This is really helpful… Actually if you are up for it use KDIFF3 as your merge tool as it supports 3-way merging. I still like the UI of WinDiff better so I keep that as my compare tool.
    Also, as compare parameter I would suggest using: /e /u /wl /dl %6 /dr %7 %1 %2 as it allows you to edit the local file which is handy when you want to copy over specific changes from a different version in TFS.

    This is the params I used to set up the merge for KDIFF3:
    %3 %1 %2 -o %4 –L1 %8 –L2 %6 –L3 %7

  5. Pingback: Spurious Logic

  6. @Kashiraja, I also thinking the same thing. Even though WinMerge have a very nice UI it was outdated since 2009. So I keep using Kdiff3.

    Now I got the way to edit in compare mode. Not so easy like WinMerge but just a few clicks away.

    (1) Simply turned to merge mode by using this arguments “%1 –fname %6 %2 –fname %7 -o %2″ note the -o switch it will create an output to the second file which is (local). but this will always prompt for saving.

    (2) Use just a normal read-only compare arguments “%1 –fname %6 %2 –fname %7″ like most people suggest. Read-only by default, to edit simply click “Merge Current File” icon or from menu item. It will will turned to merge tool, create an output in the bottom and set the B file (local) by default. We can “Choose B Everywhere” to apply (local) first and iterate each diff to be edited.

  7. Pingback: Replace diff/merge tool in Visual Studio Team System with WinMerge | paulbouwer.com « hidaren

  8. Pingback: Making Improvement Real | Concentra Blog

  9. Pingback: Visual Studio Developer Tips

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s