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!
- Download and install WinMerge here.
- Open VS , any version will work, I’m using VS 2010.
- Go to Tools –> External Tools
- 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) "\\192.168.1.1\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.
- Once you’ve edited the command and arguments, give it a useful title and click OK.
- You can now open WInMerge from within VS and it will open up with source and destination paths displayed and ready to compare.