Diffs and Merges–Better Tools for TFS
One of the most frequent tasks that developers face is ‘comparing’ (diff between) two versions of a source file. Another related task is that of merging two (or more versions of) files. The built-in comparer/merger in Visual Studio is extremely limited in this regard. There are two tools (Beyond Compare and WinMerge) out there that I have used and would recommend over the built-in comparison viewer.
Beyond Compare (free for 30 day trial only, then approximately $50 for a user license)
To configure the diff and merge to work with this tool, follow the instructions here. A quick recap of configuring it for use with TFS is given below:
Configuring Beyond Compare as the Diff tool in TFS
- In Visual Studio Choose Options from the Tools menu.
- Expand Source Control in the treeview.
- Click Visual Studio Team Foundation Server in the treeview.
- Click the Configure User Tools button.
- Click the Add button.
- Enter “.*” in the Extension edit.
- Choose Compare in the Operation combobox.
- Enter the path to BComp.exe in the Command edit.
- In the Arguments edit, use:
%1 %2 /title1=%6 /title2=%7
Configuring Beyond Compare as the 3-way Merge tool (v3 Pro)
- Follow steps 1-6 above.
- Choose Merge in the Operation combobox.
- Enter the path to BComp.exe in the Command edit.
- In the Arguments edit, use:
%1 %2 %3 %4 /title1=%6 /title2=%7 /title3=%8 /title4=%9
Configuring Beyond Compare as the 2-way Merge tool (v3 Std, v2)
- Use the same steps as the 3-way merge above, but use the command line:
%1 %2 /savetarget=%4 /title1=%6 /title2=%7
Winmerge (free, non-expiring version available)
In Visual Studio do the following:
- Click on Tools menu
- Click on Options menu item
- Expand Source Control tree item
- Select Visual Studio Team Foundation Server tree item
- Click on Configure User Tools… button
Configuring WinMerge for Comparisons (Diffs)
To use WinMerge as the Compare/Diff tool:
- Click the Add… button
- For Extension, type *
- For Operation, select Compare
- For Command, browse for C:\Program Files\WinMerge\WinMerge.exe
- For Arguments, type /x /e /ub /wl /dl %6 /dr %7 %1 %2
- Click OK to accept
Configuring WinMerge for Merging
To use WinMerge as the Merge tool:
- Click the Add… button
- For Extension, type *
- For Operation, select Merge
- For Command, browse for C:\Program Files\WinMerge\WinMerge.exe
- For Arguments, type /x /e /ub /wl /dl %6 /dr %7 %1 %2 %4
- Click OK to accept
Summary
The built in diff and merge tools in TFS (and VSS) are extremely limited. To get around these limitations, use either WinMerge (free) or Beyond Compare (free for 30 days only) – and configure these in Visual Studio as described in this post.
Leave a Reply