Compare files with Visual Studio

Visual Studio 2015 file comparison tool can be considered good enough for most of the use cases. Before learning how to compare files with Visual Studio, I used to use WinMerge, or another tool to compare. Not anymore of that!

What is still missing in the IDE is a small menu that allows us to select 2 files and compare them. From command line, you can do it with devenv.exe /diff which compares two files. It takes four parameters:
SourceFile, TargetFile, SourceDisplayName(optional), TargetDisplayName(optional)

You can launch it with below command:

devenv.exe /diff “e:\source.txt” “e:\target.txt” “SOURCE” “TARGET”

But within the IDE, things change a little. Instead of launching the command from the Command Prompt, we can do it from the command window with a syntax of style

Tools.DiffFiles SourceFile, TargetFile

which makes it more easy to use.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s