Visual Studio and WinMerge – A Happy Marriage

by Jeremy Huntsman 2. February 2011 01:03

One of my favorite tools is WinMerge, I use it virtually every day. It is an open source directory and file comparison tool that presents the differences both textually and visually in a clean and concise way.  I not only use it for simply comparison tasks, but also for deploying modified files to testing and staging environments.

I few months ago I discovered that WinMerge accepts command line parameters. I always appreciate it when developers create applications that accept command line parameters because it increases the applications usefulness tremendously. Like many developers, spend a significant amount of time in various versions of the VS IDE, therefore I have a simple equation to improve my productivity:

tool that accepts command line parameters + tool I use frequently = create VS external command

As documented here, WinMerge accepts several command line parameters including source (left) and destination(right) paths. By taking advantage of these, you can create an external command that you can execute from the tools menu (I’ve actually taken it a step further and created a WinMerge menu on my main tool bar) as an external command. This automatically brings up WinMerge with your current project as your source and your preconfigured destination. From there, comparison and deployment is just one click away, sweet!

Here’s how:

  1. Download and install WinMerge here.
  2. Open VS , any version will work, I’m using VS 2010.
  3. Go to Tools –> External Tools
  4. Enter the values per the instructions below:
    • WinMerge accepts source and destination command line parameters similar to a basic XCOPY command. So the command is very simple: C:\Program Files\WinMerge\WinMergeU.exe $(ProjectDir) "\\\c$\MyWebDirectory\MyApplicationDirectory\"
    • For the source path, Visual Studio provides the working project directory through the “$(ProjectDir)” variable. This will open WinMerge using your current project as the source.
    • The destination path is a static value and is whatever directory you wish including UNC shares.WinMerge
  5. Once you’ve edited the command and arguments, give it a useful title and click OK.
  6. You can now open WInMerge from within VS and it will open up with source and destination paths displayed and ready to compare.



Visual Studio | Tips and Tricks

Comments are closed

About the author

I am a software engineer for Applus+ Technologies. I have been working extensively with the .Net Framework, SQL Server, Oracle, and several message queuing technologies for about 8 years. I also am a Windows Media Center enthusiast. I am happily married with two awesome boys.


My Android Apps

OBDII DLC Lookup Tool

Check out my Google Gadgets

Washington Emission Queue Cams

Add to iGoogle

Illinois Emission Queue Cams

Add to iGoogle

And just to prove it can be done in a program we don't operate in...Wisconsin Emission Queue Cams

Add to iGoogle

Tag cloud