Versioning the BizTalk generated MSI files

Recently a customer of ours asked us if it was possible to include versioning information into the title of the installed MSI.

These MSI files can be generated by right-clicking a BizTalk application and selecting “Export” and then “MSI file”:

This generates the MSI file on disk.

Problem however is that the MSI file which gets generated always has version assigned to it.
We can always use Microsoft’s Orca tool to manually update the properties of the file, but this is very cumbersome to say the least.

I went on to search if there was an option to pass some parameters to BTSTask.exe.
This tool allows you to perform the “Export MSI” via the command line, allowing you to script it.
Unfortunately this tool does not allow you to set the version information at all.

Luckily, BizTalk comes with a .NET API that allows you to update the properties of the MSI installer package.
For BizTalk 2010 this is the Microsoft.BizTalk.MSIManager assembly.

using Microsoft.BizTalk.ApplicationDeployment.MSIManager.WindowsInstaller;

This assembly allows you to query/update the MSI database structure contained within the MSI file.

Just provide the following code to update the name of the application for example:
msiPath = full path to your MSI
applicationName = your custom application name that will appear in your “Programs and Features” list under Windows.

static public void UpdateMSIApplicationName(string msiPath, string applicationName)static public void UpdateMSIApplicationName(string msiPath, string applicationName)
Database db = Installer.OpenDatabase(msiPath, DatabaseOpenMode.Transact);
string query = @”UPDATE Property SET Property.Value = ‘” + applicationName + “‘ WHERE Property.Property = ‘ProductName'”;
Microsoft.BizTalk.ApplicationDeployment.MSIManager.WindowsInstaller.View vw = db.OpenView(query);
vw.Execute(); vw.Close();

I also tried updating the version information, but for some reason this will insert some minor errors during installation having to do with the registry.
I believe this has to do with the registry keys that are installed by default within the BizTalk MSI version.

Incorporating all of this into a properly automated build/deployment scenario will allow you to publish your MSI files with customized versioning.

Good luck.

Leave a Reply

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

You are commenting using your 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 )

Connecting to %s