Compare files in Visual Studio IDE using DiffFiles Tool

Compare files in Visual Studio IDE using DiffFiles Tool

You can use Visual Studio to compare two files. Comparison of two files becomes easy when you have code in source control. However, for a regular comparison between two different files, we often look at different tools. Well, you can utilize the Visual Studio DiffFiles Tool for the same. It’s there with Visual Studio for long; however, it is often overlooked and many developers may unaware of this great tool. We can invoke this utility tool from Command Window. The Visual Studio Command Window is very powerful and can help you to execute things faster during development. The Command window can execute commands directly in the Visual Studio by using their names.

Launch the Command Window by navigating from View  –> Other Windows –> Command Window.

 

Related Tip :Using multipurpose Command Window to execute things faster in Visual Studio

 

The following screenshot shows a new command window open. The “>” indicates it is ready to accept commands.

image

Once you start typing here; you will find the available intellisene  to select the commands faster.  For an instance, as soon as I type file, I can see following list of command that are related with file.

image

 

Use Tools.DiffFiles  command and provide both the FileNames as parameters and press enter. This will bring the comparison editors for the given files.

 

You can then leverage the Compare Files – Tools for different set of comparison along with navigating through  the difference.

Following images show the inline mode of comparison for the selected files.

That’s it.

As said earlier, many of you may familiar with this utility, however this is something overlooked features of Visual Studio.

 

9 Hidden Features of Visual Studio that you should know

 

Give it a try if you haven’t.

Abhijit Jana

Abhijit runs the Daily .NET Tips. He started this site with a vision to have a single knowledge base of .NET tips and tricks and share post that can quickly help any developers . He is a Former Microsoft ASP.NET MVP, CodeProject MVP, Mentor, Speaker, Author, Technology Evangelist and presently working as a .NET Consultant. He blogs at http://abhijitjana.net , you can follow him @AbhijitJana . He is the author of book Kinect for Windows SDK Programming Guide.

7 Comments to “Compare files in Visual Studio IDE using DiffFiles Tool”

  1. Skip Munk

    “Compression of two files becomes easy when you have code in source control.”
    Should this be “Comparison” rather than “Compression”?

  2. Ashwin

    Great tip! Now its very easy to compare files and no need of any online tool to check the difference. This will definitely come handy in day to day development.

Comments are closed.