Configuring Subversion to Correctly Handle BizTalk Files

Subversion is a great open-source version control system, however it doesn’t work all that well with BizTalk solutions straight out of the box, particularly orchestration, pipeline and map files. In order to get these artifacts working seamlessly, there are a number of configuration changes that need to be made.

Contextual-Merging & MIME Types

When changes are received from the repository during an update of a local working file, Subversion attempts a contextual, line-based merge of changes. When this is performed on certain Biztalk files (including orchestrations, pipelines and maps) the result is an unreadable file in Visual Studio – the contextual, line-based merge simply can’t handle the file content unless given a little help by correctly specifying the file MIME-type through the Subversion svn:mime-type property.

Because Orchestrations, Maps, Pipelines and Schemas are essentially only Xml (orchestrations may additionally contain embedded XLANG/S code), we can easily set the MIME-type property to text/xml. The property can either be set using the TortoiseSVN Windows Explorer shell extension or via the the Subversion command-line propset command:


svn propset svn:mime-type text/xml TestOrchestration.odx
svn propset svn:mime-type text/xml TestMap.btm
svn propset svn:mime-type text/xml TestPipeline.btp
svn propset svn:mime-type text/xml TestSchema.xsd

To check that the property has been set correctly, you can use the subversion propget command:


svn propget svn:mime-type TestOrchestration.odx
> text/xml

This change ensures that when a local working copy of the file is updated from the repository, Subversion handles the line-based merge correctly. If you need to maintain binary files within your repository, such as InfoPath XSN files, you will need to set the MIME-type property to application/octet-stream.

More information about the MIME-type property can be found in the Subversion Online Help.

Mass Updating File Properties 

Although the TortoiseSVN Explorer shell extension and Subversion command line utilities are helpful, they only operate on one file at a time. To get around this problem, I have written a small VBScript to recursively apply Subversion properties to specified file types within sub-folders – any subversion property can be applied to any file type using the script. A simple batch file could be used to execute the script on each file-type as follows:

cscript SvnSetProps.vbs false "svn:mime-type text/xml" .btm "..IntegrationBiztalk"
cscript SvnSetProps.vbs false "svn:mime-type text/xml" .btp "..IntegrationBiztalk"
cscript SvnSetProps.vbs false "svn:mime-type text/xml" .odx "..IntegrationBiztalk"
cscript SvnSetProps.vbs false "svn:mime-type text/xml" .xsd "..IntegrationBiztalk"
cscript SvnSetProps.vbs false "svn:mime-type text/xml" .xml "..IntegrationBiztalk"
cscript SvnSetProps.vbs false "svn:mime-type application/octet-stream" .xsn "..IntegrationBiztalk"

You can download a copy of the SvnSetProps.vbs script here – please be aware that the script doesn’t do any error checking, so make sure you are confident in its operation by setting the second parameter (‘pretend’) to true – although it appears to be applying the changes, nothing is actually happening. Once you have applied the changes, they need to be committed back to the repository.

Disclaimer

This work is licensed under a Creative Commons Attribution 2.5 License – you can use commercially and modify as necessary, but you must give the original author credit. Furthermore, this script is provided “AS IS” with no warranty. Click the image below to view further detail of the licence.

Creative Commons License

Advertisements

One thought on “Configuring Subversion to Correctly Handle BizTalk Files

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s