I found the default diff/merge tool in Visual Studio 2012 to be a huge improvement over previous versions, as you know is actually able to see what has changed quite easily.
But that being said, I still prefer to use WinMerge as the default diff/merge tool since it has more features. Another nice feature of WinMerge is the possibility to integrate it into Windows Explorer which allows me to diff files (and folders) on my hard drive.
So how do you make WinMerge the default diff/merge tool in Visual Studio?
Go into “Tools –> Options –> Source Control –> Visual Studio Team Foundation Server”, click on “Configure User Tools …”, and add new commands for the “Compare” and “Merge” operations.
Values for the compare command;
Extension: .* (meaning all files)
Command: C:\Program Files (x86)\WinMerge\WinMergeU.exe (the path to where WinMergeU.exe is located)
Arguments: /e /u /wl /dl %6 /dr %7 %1 %2 (the arguments for WinMerge, I’ll explain them in detail further down)
Values for the merge command;
Command: C:\Program Files (x86)\WinMerge\WinMergeU.exe
Arguments: /e /u /wl /dl %6 /dr %7 %1 %2 %4
After you add these two commands, right-clicking a file in Visual Studio and selecting “Compare…” should result in the two files being opened and compared in WinMerge. Should you want to go back to using Visual Studio’s own diff/merge tool, you just remove the two commands again.
So what do the values used in the arguments field in the two commands actually mean?
Values starting with a forward slash (/) are WinMerge command-line parameters. The full list of possible parameters can be found here. But I’ll list the ones I use (not all of them are necessary, you may remove some or add others as you prefer):
/e –> Enables you to close WinMerge with a single Esc key press
/u –> Prevents WinMerge from adding either path (left or right) to the Most Recently Used (MRU) list
/wl –> Opens the left side as read-only
/dl –> Specifies a description in the left side title bar
/dr –> Specifies a description in the right side title bar
Values starting with a percentage sign (%) are provided by Visual Studio as input for the WinMerge parameters. You can see what they stand for by clicking the “play” button behind the arguments field when you create the command, but I’ll list them here as well (I’ve greyed out those I don’t use):
%1 –> Original file
%2 –> Modified file
%3 –> Base file
%4 –> Merged file
%5 –> Diff command-line options
%6 –> Original file label
%7 –> Modified file label
%8 –> Base file label
%9 –> Merged file label
WinMerge can be downloaded the from here.