Configure Diff to Show Whitespace

Back in TFS 2005, if you used the Compare command to compare the contents of two source files, differences in whitespace were ignored by default.  In the case where two files differed only in whitespace, we didn’t even display the diff tool, but showed the following dialog:

image

While we received feedback that many users didn’t like this behavior (differences in whitespace don't mean identical), there are some users that actually do not care about files differing only in whitespace.

To enable the compare tool to ignore whitespace, the /ignorespace option can be used.  Configuring the compare tool to use this option by default involves the following:

  1. Click Tools -> Options.
  2. In the Option dialog, go to Source Control, and find the Visual Studio Team Foundation Server section.
  3. Click on the Configure User Tools button to modify the compare and/or merge tool(s).
  4. On the Configure User Tools dialog, click Add to add a new tool using the following parameters:
    • Extension: .*
    • Operation: Compare
    • Command: C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\diffmerge.exe
    • Arguments: %1 %2 %6 %7 %5 /ignorespace

image

James Manning has a great blog post about how to configure many popular third party compare and merge tools.  Check it out for all of the details on the how tools are configured, and what those % options really mean.