A little-known feature of Visual Studio is that it can be used as a two-way diff tool. The diff tool can be invoked from the command line, which means that it can be easily integrated into most source control clients. Using VS as your diff tool allows you to remain in the IDE while diffing your changes against source control. You can make changes to your local file with the benefit of intellisense and ReSharper (if you have it) while the diff updates in real-time.
To invoke Visual Studio’s diff tool from the command line, call devenv.exe (the VS executable) with the “/diff” switch. Devnenv.exe is located in %VS110COMNTOOLS%/../IDE, typically “C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE”. This is the path for Visual Studio 2012 (version 11), but the basic pattern holds for other versions — each VS install creates an environment variable to the “common tools” directory which can be used to locate the “IDE” directory. Also note that if you are using Visual Studio Express, you will not find “devenv.exe” — the executable will be called something like “WDExpress.exe”.
When using the /diff switch, you must pass two arguments — the paths to the two files to diff. The first will appear on the left in the IDE, the second on the right. You can optionally pass two additional arguments, which VS will use as the “name” of the left and right files. These optional parameters are useful when integrating with source control, where the files may have odd temporary paths — names such as “SOURCE” and “TARGET” or “THEIRS” and “MINE” could be appropriate. The full command line, assuming %1 and %2 are the two files to be diffed, looks something like this:
"%VS110COMNTOOLS%/../IDE/devenv.exe" /diff %1 %2 NAME1 NAME2
Provide this command to your source control client (using the appropriate named parameters for the files to be diffed — these will vary by source control system), and you’ll be diffing without leaving the IDE in no time.