Compare files in Visual Studio IDE using DiffFiles Tool

By | January 9, 2018

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.

7 thoughts on “Compare files in Visual Studio IDE using DiffFiles Tool

  1. Pingback: Dew Drop - January 9, 2018 (#2639) - Morning Dew

  2. Skip Munk

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

  3. 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.

  4. Pingback: Dew Drop - January 10, 2018 (#2640) - Morning Dew

Comments are closed.