How to diff two files in Visual Studio without using source control

I have been using Visual Studio for years. Every time I have had to diff two files I went to notepad++ or some other great text editor. However I have recently discovered that you can actually do this from Visual Studio - with a bit of tinkering.

Visual Studio can easily diff files that are under source control. However sometimes you have two files which you wish to see the differences of. There is no way to just select two files, right click and diff them. But you can call a command to do so using Tools.DiffFiles in the command window. I will give you an example: If you have a project with two classes like below:

Visual Studio solution with two classes

You can easily diff the two files using the following command:

Tools.DiffFiles Class1.cs Class2.cs

Which will give you the usual window when diff'ing two files:

Diffing two files using Tools.DiffFiles

There is nothing more to it, this is how you can diff files within Visual Studio. Tools.DiffFiles will also help you autocomplete paths to the files you are looking for - making it easier for you to get them right. It can also diff files that are not part of your projects.

The command window which can be seen at the bottom of the above image can be found at "View -> Other windows -> Command window" or use quicklaunch (ctrl + q and search for "command window"). This window can also be found using ctrl + alt + a.

That's it, I hope you enjoy this and I wish that the Visual Studio team will build this into the UI at some point! Let me know what you think in the comments.