Friday, January 20, 2012

Visual studio compare and merge goodness



When doing a diff more complex than a == b using the standard diff/merge tool that comes with visual studio is an experience that no developer should need to go  through. I don't think that diff tool has changed since the black Visual SourceSafe days.

But there is a way to make your life so much nicer. I use WinMerge as the diff tool when in visual studio.
Follow this steps if you want to get rid of (some atleast) of the pains of merging code:

1. Download and install WinMerge
2. In Visual Studion go to Tools -> Options -> Source control ->Visual Studio Team Foundation Server and click on the Configure User Tools button.
3. If you don't have the two commands for compare and merge, then add one for each and set the file path to your WinMerge executable, mine is C:\Program Files (x86)\WinMerge\WinMergeU.exe. The extension should be .*
3a. The arguments for compare is /e /x /s /wl /dl %6 /dr %7 %1 %2
3b. and for merge /e /s /x /ub /dl %6 /dr %7 %1 %2 %4

Done!
Now next time you do a merge diff or compare Visual studio will use WinMerge instead.