Thursday, January 17, 2008

Customizing Visual Studio Compare and Merge Utility

Are you missing your favorite file compare utility because TFS ships diffmerge utility? No doubt the it has solid merge utility but compare only shows horizontal comparison and leaves us without any clue about what’s changed in the highlighted (until we manually find the change in highlighted line).

I have many time tired gvim to compare 2 files. Here is a trick by which you can put your ‘favorite utility’ on fire.

Go to Visual Studio -> Tools -> Option -> Source Control -> Visual Studio TFS. Click on ‘Configure User Tools…”. Here you can configure your ‘Compare’ and ‘Merge’ tools separately.

This is my configuration:

Extension: .cs
Operation: Compare
Command: C:\Program Files\Vim\vim71\gvim.exe (you have to fully qualify the path. Specific for GVim, add C:\Program Files\Vim\vim71 to your $Path)
Arguments: -dR %1 %2

Also, you can pass various arguments for existing diffmerge utility. Here is example to pass ‘ignorespace’ argument.

Extension: .cs
Operation: Merge
Command: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\diffmerge.exe
Arguments: /ignorespace /merge %1 %2 %3 %4 %6 %7

Although /ignorespace is not a recommended but you may want that to do in some specific case.

See complete tutorial here... http://blogs.msdn.com/jmanning/articles/535573.aspx

2 comments:

Yogee said...

Adding to above...
WinDiff is utility which is shipped with Visual Studio. WinDiff only compares two files. Usually, you can find that in: C:\Program Files\Microsoft Visual Studio\Common\Tools

Yogee said...

If you need diffmerge to Compare with ignorespace, these arguments are for you

Extension: .cs
Operation: Compare
Command: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\diffmerge.exe
Arguments: %1 %2 %6 %7 %5 /ignorespace