Ages ago, I found Microsoft's xml diff and patch tools on gotdotnet. Dead useful little package - it does exactly what it says on the tin, diffs and patches xml files.
I went looking for it again today, and of course, link rot had set in. Microsoft is phasing out gotdotnet, so when you head on over to http://apps.gotdotnet.com/xmltools/xmldiff/ you get an "Unspecified error" page, with no helpful links. Bit of a shame, that, seeing how loads of pages around the web point you there.
Fortunately, there are a couple of msdn articles. The first gives a nice overview of using the xmldiffpatch assembly in your own code, but not of the tools. And the link to download the tools returns an out of date 1.0 version.
But, that download has a sample to generate a html file from two differing xml files. And this second msdn article creates a Windows Form app over the top of this sample to generate and display the differences in a hosted browser window. Again, this uses an out of date 1.0 version.
Finally, I look at the home page of www.gotdotnet.com (which still has people uploading samples even though it's being decommissioned) and find a link to the XML tools page on msdn. Now, we get the newer 1.1 version. (There's also a link to the quite useful Xml Notepad on that page.)
And it doesn't install on Vista.
It's demanding .net 1.1 to be installed.
Keep me covered, I'm going in.
First, we need to open the executable in Visual Studio. This should display the resource view. Expand the RCDATA node, and right click on "CABINET". Export this data as "cabinet.cab". Switch back to explorer, and double click on the .cab file. You can now copy out setup.exe, setup.ini and XmlDiffPatch.msi. In fact, we're just interested in the .msi file. If you double click on it, you get an error message that .net 1.1 isn't installed.
I can't find a way to fix this easily. The msi file has a custom action that checks for the installed .net framework versions, and compares them against a property it has stashed away. It would be nice if we could have just changed the SupportedRuntimes value in the setup.ini, or passed in an override value for the VSDSupportedRuntimes property on the command line, but no. We have to edit the .msi file. You'll need Orca installed (I think it comes as a .msi in the Windows SDK). Open the .msi file, scroll down to "CustomAction" and delete the VSDCA_VsdLaunchConditions custom action. Save the file and exit.
Double clicking the .msi will now allow you to install the software. Phew.
It seems to work, but bizarrely, the XmlPatch.exe file gains the Vista UAC shield. I guess because it's got the word "patch" in the name (and because it's in the Program Files directory. Copy it out, and it's fine). That's a bit pants. To fix that, you'll need to copy the following into a file called XmlPatch.exe.manifest:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="220.127.116.11" processorArchitecture="X86" name="XmlPatch.exe" type="win32"/>
Then drop to a command prompt. Seeing how you've already got the Windows SDK for Orca, you'll also get mt.exe from there. It should be the latest version (there are bugs in previous versions which can cause blue screens!). Run the following command line, using the mt.exe from the SDK:
mt -manifest XmlPatch.exe.manifest -outputresource:XmlPatch.exe
Finally, we've got a version of the xml diff and patch tools, ready to use. And it even comes with source. Installed to Program Files so that you can't compile it without moving it, but you've got source code. You can now build the all important dll, the XmlDiff and XmlPatch command line utils, and there's that sample that generates a html diff view for you. This was the sample I wanted to build, and what caused all of this pain. It'd better be worth it.