This post could be interessting for you, if you get the message “Binary files differ” in Visual Studio.
Comparing two files is a common task for a developer. When using Team Foundation Server as source control, it is very comfortable using Visual Studio’s built-in compare feature for file history. However when comparing Office documents like Word (.doc, .docx), Excel (.xls, .xlsx) or even .pdf things become difficult. The only information you will get is that files are different. It is not possible to see the differences as it is possible in the way of simple text code files.
How Office documents can be compared?
To compare these file types you need another diff tool that is able to compare that files and integrate it in your Visual Studio. I’m using WinMerge which is cost free and comes with a lot of plugins.
1. WinMerge with xdocdiff Plugin
At first you need to download WinMerge and xdocdiff Plugin. WinMerge is a very good and common tool to compare files. The xdocdiff Plugin enables WinMerge to compare Microsoft Office documents.
Please read the installation guide of xdocdiff to configure the plugin in WinMerge.
xdocdiff supported file formats
- .rtf – Rich Text
- .docx/.docm – Microsoft WORD 2007(OOXML)
- .xlsx/.xlsm – Microsoft Excel 2007(OOXML)
- .pptx/.pptm – Microsoft PowerPoint 2007(OOXML)
- .doc – Microsoft WORD ver5.0/95/97/2000/XP/2003
- .xls – Microsoft Excel ver5.0/95/97/2000/XP/2003
- .ppt – Microsoft PowerPoint 97/2000/XP/2003
- .sxw/.sxc/.sxi/.sxd – OpenOffice.org
- .odt/.ods/.odp/.odg – Open Document
- .wj2/wj3/wk3/wk4/123 – Lotus 123
- .wri – Windows3.1 Write
- .pdf – Adobe PDF
- .mht – Web Archive
- .eml – Exported files from OutlookExpress
2. Ensure WinMerge and xdocdiff is working
To ensure that everything is working you should compare two Office documents using WinMerge manually.
3. Configure Visual Studio 2010 to use WinMerge
Go to Visual Studio / Options / Source Control / Visual Studio Team Server
Use the following settings to configure WinMerge to act as compare tool.
Command: C:\Program Files\WinMerge\WinMergeU.exe
Arguments: /x /e /ub /wl /dl %6 /dr %7 %1 %2
In the Extension field you can add all xdocdiff supported formats from above.
4. Test Compare feature
Here I’m using a simple Excel file that looks like this…
In the Source Control Explorer of VS navigate to a controlled Excel document, view the History and click Compare.
5. Compare Result
WinMerge will open automatically and show the difference of the two versions.