Diff File made easy with VisualStudio 11

In my previous post I’ve been critic on the Visual Studio 11 Beta greyed UI (and especially greyed icons!!). Let’s be positive, and frankly it is easy to be positive. I am using VS 11 beta for a week and it will be an awesome release in terms of features and performance improvement. My only hope is that they won’t waste all these efforts, and they’ll fix the depressing UI theme, or at least let the choice to the user to get back colors where it makes the most sense (icons, panels boundaries…).

So one apparently hidden feature, I discovered through the John Robbin’s blog is the new diffing capabilities of VS11! Just type in a command window…

C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE>devenv /diff 
C:\Tests\OnNUnit_Src\NUnit2_5_3\src\NUnitCore\core\TestMethod.cs 
C:\Tests\OnNUnit_Src\NUnit2_5_8\src\NUnitCore\core\TestMethod.cs

…and you’re done!

If a VS11 instance exists, it will be used, else, a new VS11 instance will be started to host the comparison panel. And there will be also the possibility to compare folders. Notes that with a bit more work, the VS11 diff text files feature could look like the awesome Kompare UI:

And, let’s precise a cool side note, the current version of NDepend supports already this VS11 feature! In the file VisualNDependOptions.xml, that you can find in the folder specified in NDepend > Options > Export/Import/Reset Options, you just need to refactor the <DiffTool/> tag this way…

<DiffTool ExeFilePath=”C:\Program Files\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe” CommandLineArgs=” /diff $OldSrcFilePath$ $NewSrcFilePath$” />

… and it just works. Of course the next version of NDepend will integrate in VS11 and will cleanly supports this feature:

The user won’t have to tweak the XML manually, VS11 diff will be proposed per default in the list of default diff tools that the user can plug to NDepend:

This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://twitter.com/jessehouwing Jesse Houwing

    To easily compare folders, use:
    tf.exe folderdiff folderA folderB

    As long as you’re not using a server path ($/../../ etc), there’s no need to supply a TFS Project Collection Uri.

  • Patrick Smacchia

    No idea?

  • Jeremy

    Is there any keyboard shortcut or similar to compare 2 random side by side files a la Notepad++’s Compare plugin from within the IDE?

  • http://twitter.com/bojanbjelic Bojan Bjelic

    Worth it only if they make it work / look like Kompare, that looks awesome. 

  • Alok Kumar

    I have not checked but definitely merge feature should be there. Diff and merge are important activities for distributed teams. Thanks for sharing.

  • 80s Rocker

    Looks nice, but would have to see full features to see if it makes having license for beyond compare.

  • http://www.exsystems.co.uk/?page_id=1349 Rita Joel2011

    Thanks for sharing a knowledgeable post. 

  • Jim Cooper

    It’s awesome to see that they will finally have a good built in diff tool (hopefully it includes merge).  Thanks for sharing.  I have to confess though, I prefer the “aligned” UI that it appears to have natively to the Kompare UI.  I’ve used P4 merge, which also uses the colored sections to show alignment, like Kompare does.  It’s probably my weak mind, but I do much better when the lines of code stay aligned so that I can look across left to right and see more clearly where the lines of code align.

  • http://twitter.com/sbp_romania SBP Romania

    compare folders – this sounds pretty good! so this could be a nice alternative to DiffMerge.