TFS is a great source control solution, however it can be a pain when trying to merge or even compare code when merging branches together (especially when you cut and paste code into a new IF statement – the code comparison gets shuffled down considerably, making comparing the two changesets very difficult).
Thankfully, KDiff is a free tool which performs much better than the default tools (in my opinion).
You can download and install KDiff from here:
http://kdiff3.sourceforge.net/
Once you have installed Kdiff, it is now time to configure TFS.
Go to Tools -> Options:
Go to Source Control -> Visual Studio Team Foundation Server -> Configure User Tools:
You will now want to add two new operations for comparing and merging.
Note, in the following picture examples, replace ‘C:\Program Files\KDiff3’ with the path where you have installed KDiff.
Compare operations
Note, the arguments are:
%1 –fname %6 %2 –fname %7
Merge operations
Note, the arguments are:
%3 –fname %8 %2 –fname %7 %1 –fname %6 -o %4
That should be it. This will now ensure that TFS will use the KDiff tool when comparing any type of file. Note, you can change these operations to be specific to certain code files (instead of an ‘.*’ extension, you could use ‘.vb’, for example)
If you would like more information on the arguments used or use a different comparison tool, please read the following informative post:
Hope this helps,
Stefan.
For more Web Code, ASP.NET, SQL Server and other development tips, please check back here at webcodeblog.com often.



