Jeremy Davis
Jeremy Davis
Sitecore, C# and web development
Article printed from: https://blog.jermdavis.dev/posts/2014/bonus-chatter-visual-studio-diff

Bonus chatter: Using the Visual Studio diff window to compare any files

Published 25 April 2014
Updated 26 June 2018
Visual Studio ~½ min. read

A neat little trick I discovered recently, and promptly forgot to share is that you can make use of Visual Studio's diff window for any pair of files, without the need for a project or solution. All you need is a little command line trickery.

For VS2012 you can type:

"%VS110COMNTOOLS%/../IDE/devenv.exe" /diff {fileOne} {fileTwo} {displayNameOne} {displayNameTwo}

					

(If you're running VS2013, you can use the environment variable VS120COMNTOOLS instead)

Just replace {fileOne} and {fileTwo} with the absolute paths to the files you want to compare. You can optionally provide {displayNameOne} and {displayNameOne} as "friendly names" for the two diff panes.

And up pops a window like:

Untitled

Could be useful for scripts and tools that need to display differences between files...

↑ Back to top