Xml Diff and Patch tools

by matt 16. April 2007 22:35

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="1.0.0.0" processorArchitecture="X86" name="XmlPatch.exe" type="win32"/>
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker"/> 
      </requestedPrivileges>
    </security>
  </trustInfo>
</assembly>

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.

Tags:

Vista | .net tools

Comments

4/18/2007 12:34:49 AM #

RE: Xml Diff and Patch tools

wow. that was easy Wink

lb | Reply

4/18/2007 9:02:06 PM #

RE: Xml Diff and Patch tools

Just a walk in the park, Kazansky

Matt Ellis | Reply

6/18/2008 2:12:06 PM #

RE: Xml Diff and Patch tools

The MSDN links are out of date again - the post at [2] contains a working link though.

Not having orca and being intimidated by the size of the download, I was able to extract it using the simple little tool at [2].


[1] http://www.jsware.net/jsware/msicode.php3

[2] forums.microsoft.com/.../ShowPost.aspx

Jason | Reply

4/23/2009 11:23:36 PM #

low cost franchise

Heya - Just looking through some blogengine.net blogs, seems to be a fairly nice platform, certainly better than blogger but still playing with the idea of wordpress.  Any major plus points you have found over WP at all?

Thanks

Matthew

low cost franchise United Kingdom | Reply

4/24/2009 1:48:53 PM #

matt

I haven't really used any other blog engine. I previously used a different open source platform that wasn't as good as BlogEngine. So, I can't really compare with WordPress and Blogger and all.

But I've got no real complaints about BlogEngine.net - I think it's great. I like it because it's .net and open source, and I'm a .net developer and so can play around with it. Plus, it's got essentially all of the features I'm interested in. As far as I'm concerned, I'd give it a hearty recommendation.

Matt

matt United Kingdom | Reply

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.5.0.3
Theme by Mads Kristensen

About the author

Something about the author

Calendar

<<  July 2009  >>
MoTuWeThFrSaSu
293012345
6789101112
13141516171819
20212223242526
272829303112
3456789

View posts in large calendar

RecentComments

Comment RSS