Avoid dependency issues while deploying BizTalk applications

January 18, 2010 at 8:35 AM

Sometimes it can be very tricky to deploy a BizTalk application because of assembly dependencies.
But recently I found an easy way to determine these dependencies on a running BizTalk environment.

Imagine the scenario where you have to do a patch of a certain assembly and you get following error.
Cannot update assembly "X.dll" because it is used by assemblies which are not in the set of assemblies to update. 
This also shows a list of dependencies that use this assembly. It's not such a big deal that you get this error. But you don't want this to happen while your customer is watching.  It can also make automated deployment fail.
You can solve this with an easy C# application that creates this list before you try to deploy.

First reference C:\Program Files\Microsoft BizTalk Server 2009\Microsoft.BizTalk.Deployment.dll.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BTS = Microsoft.BizTalk.Deployment;
using System.Data.SqlClient;

namespace TestApp
{
    class Program
    {
        static void Main(string[] args)
        {
            SqlConnection conn = new SqlConnection("Data Source=(local);Initial Catalog=BizTalkMgmtDb;Integrated Security=SSPI;");
            BTS.DependencyInfo di = new BTS.DependencyInfo();
            BTS.BizTalkAssemblyName btsAssName = new BTS.BizTalkAssemblyName("assemblyname", "1.0.0.0", "neutral", "publicKeyToken");

            foreach (BTS.BizTalkAssemblyName assn in di.GetUsedBy(conn, btsAssName))
            {
                Console.WriteLine(assn.FullName);
            }

            Console.ReadLine();
        }
    }
}

And that is it. You can also call this recursively to determine the entire depency tree. But with this simple code, you can save yourself some time while deploying, or help your automated deployment.

Tim D'haeyer

Posted in: BizTalk

Tags:

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading