Synchronize XSD from an InfoPath document with a SharePoint project for server-side XSD validation

In order to implement server-side XSD validation against an InfoPath form submission, I had to pull the XSD from the InfoPath document archive (XSN file) and use that to update an embedded resource in a SharePoint solution project (including automated checkout/checkin in TFS). I was able to do it using a batch file. Pretty specialized…