Inside VSTS

Performing Comparisons with Team Foundation Server

When the diffmerge tool in TFS isn't enough, here's how to replace it with something better.

One of the great things about Team Foundation Server (TFS) is its extensibility. People can talk all they want about how "closed" Microsoft software is, but in the majority of cases that's just not true. Extensibility is one of the platform goals of Visual Studio Team System (VSTS), and nowhere is this more helpful then when trying to compare file versions.

(Note that in addition to changing comparison tools, you can also change the merge tool. Most advanced comparison tools perform both compares and merges so the same tools can be used for both.)

The built-in file comparison tool for TFS is the same tool as in VSTS: diffmerge. The tool is functional, has certainly stood the test of time, and handles text files just fine. But as anyone who uses the tool knows, it doesn't do anything else. It can't handle Word or Excel documents (frequently used for requirements and test cases), three-way merges, or XML files. OK, XML files are just text files so it can handle XML files, but it doesn't treat the file as an XML file, which limits its usefulness. In addition, XML is a structured file type and, when handled as a text file, there's no structure to it.

So, what to do?

My favorite tool for comparing XML files is DiffDog from Altova. We all know and love Altova (at least, those of us who work with a lot of XML) for all the great XML tools it provides. DiffDog has been around for about three years or so, but for some reason it isn't used as much as I thought it would be.

Because of this, I wanted to show how to replace the default merge tool in TFS with the DiffDog tool. If you're interested in using other tools, see James Manning's blog for a list of other comparison tools and the TFS command line arguments for them.

To replace the diffmerge tool, in Visual Studio go to Tools > Options > Source Control > Visual Studio Team Foundation Server (Figure 1) and select Configure User Tools (Figure 2). Select Add and enter the extensions that DiffDog should be used for (in this example, both .XML and .PROJ because all .PROJ files are MSBuild XML files). The great thing about TFS is that it will use the tool registered with the given file type so you can use multiple tools depending on the extension.

Provide the path to DiffDog and leave the default arguments alone. The arguments on this command line determine what values TFS passes to the differencing tool. The Configure User Tools dialog will list each extension separately. At this point, you can compare two different XML files or different versions of the same file and you'll be presented with several options for viewing the file in DiffDog.

Figure 3 shows the default comparison view of two versions, the "xml" mode in a flat view. Switching to the Grid view gives you a structured view that's more easily navigable, as shown in Figure 4. Note that the differences are highlighted and sections can be collapsed. Also, lines between the two versions show the location of where the text (in this case, text was deleted from one version to the other in addition to some other changes) was in the older version of the file.

DiffDog is just one file comparison tool. For normal file types, I tend to recommend Beyond Compare because it provides excellent support for file and folder comparison.

But with the explosion of XML, XHMTL, XML schemas and XML resource files, being able to quickly and easily compare versions of an XML file is becoming more and more important. TFS allows you to save time and effort by providing you with the means to work the way you want to work.

About the Author

Jeff Levinson is the Application Lifecycle Management practice lead for Northwest Cadence specializing in process and methodology. He is the co-author of "Pro Visual Studio Team System with Database Professionals" (Apress 2007), the author of "Building Client/Server Applications with VB.NET" (Apress 2003) and has written numerous articles. He is an MCAD, MCSD, MCDBA, MCT and is a Team System MVP. He has a Masters in Software Engineering from Carnegie Mellon University and is a former Solutions Design and Integration Architect for The Boeing Company. You can reach him at

comments powered by Disqus
Upcoming Events

.NET Insight

Sign up for our newsletter.

Terms and Privacy Policy consent

I agree to this site's Privacy Policy.