BizTalk Deployment Framework is Your Friend

One of the first things I do when building a new BizTalk application is to get a BizTalk Deployment Framework (BTDF) project set up. It only takes a few minutes and makes life much easier; not just when you come to deploy your bits onto a server, but throughout the development process as well.

Visual Studio lets you right-click deploy BizTalk projects, but this only takes care of some of the steps required to get an application deployed - you'll need to manually deploy additional assemblies, import your bindings, restart host instances, set up references between BizTalk applications etc. BTDF does all this for you and it's built on top of MSBuild so if you've got funky custom stuff in your deployment process you can write extensions to automate it.

BTDF does work better if you follow some conventions with respect to project structure – the main one being that you break up your application into projects by artefact type - i.e. you have separate projects for schemas, transforms, pipelines, orchestrations etc. I tend to consider this a good practice to follow even if you are not using BTDF.

Here are the steps I usually go through to get up and running when creating a new application. Let's say we are creating a new application to process transactions for our company.

  1. If you don't already have it, download BTDF from Codeplex.

  2. Open up Visual studio and create a new blank solution called TransactionProcessing (this can be found in "Other Project Types, Visual Studio Solutions").

  3. Add the following empty BizTalk projects to your solution: TransactionProcessing.Schemas, TransactionProcessing.Transforms, TransactionProcessing.Orchestrations. You could also add pipelines, pipeline components, custom functoids etc but I'll keep it simple.

  4. Add a class library project to your solution called TransactionProcessing.Components.

  5. Use the project properties tabs to make sure the output of each of your projects is signed with a strong name key file.

  6. Change the assembly name and default namespace for each to include the MyCompany prefix – e.g. MyCompany.TransactionProcessing.Components etc.

  7. Create a new Deployment Framework for BizTalk Project and call it TransactionProcessing.Deployment. Leave all the settings as their default values and click "Create Project".

  8. When you create a new BTDF project, it creates some files but doesn't add them to your solution. Add them manually by create a new solution folder called TransactionProcessing.Deployment; then add the items created by BTDF to your solution folder.

  9. Go to the TransactionProcessing.Deployment solution folder and rename the Deployment.btdfproj file to TransactionProcessing.Deployment.btdfproj.

  10. Open the Deployment.btdfproj file in your TransactionProcessing.Deployment solution folder. This contains the configuration for your BizTalk deployment project. There are lots of settings you can tweak here but we'll keep it simple and just do the bare minimum to get up and running.

  11. Find the <ItemGroup> element that includes a <Schemas> element within – it should be near the end of the BTDFPROJ file. Update this to look like the following:

        <Schemas Include="MyCompany.TransactionProcessing.Schemas.dll">
          <LocationPath>..\$(ProjectName).Schemas\bin\$(Configuration)</LocationPath>
        </Schemas>
  12. Directly below the schemas section, add entries for the other projects in your solution. When you're done it should look like this:

      <ItemGroup>
        <Schemas Include="MyCompany.TransactionProcessing.Schemas.dll">
          <LocationPath>..\$(ProjectName).Schemas\bin\$(Configuration)</LocationPath>
        </Schemas>
        <Transforms Include="MyCompany.TransactionProcessing.Transforms.dll">
          <LocationPath>..\$(ProjectName).Transforms\bin\$(Configuration)</LocationPath>
        </Transforms>
        <Orchestrations Include="MyCompany.TransactionProcessing.Orchestrations.dll">
          <LocationPath>..\$(ProjectName).Orchestrations\bin\$(Configuration)</LocationPath>
        </Orchestrations>
        <Components Include="MyCompany.TransactionProcessing.Components.dll">
          <LocationPath>..\$(ProjectName).Components\bin\$(Configuration)</LocationPath>
        </Components>
      </ItemGroup>

    If it's not obvious from the XML above, any time you want an assembly deployed you need to add it to this section. If you have other project types like pipelines you'll need to add them here also.

  13. Go to the top of the file and modify the property group containing the core BTDF configuration. Usually this is at the top of the file. Add the following entries to it:

        <IncludeSchemas>True</IncludeSchemas>
        <IncludeTransforms>True</IncludeTransforms>
        <IncludeOrchestrations>True</IncludeOrchestrations>
        <IncludeComponents>True</IncludeComponents>
        <IncludeMessagingBindings>False</IncludeMessagingBindings>

    If you have bindings to deploy you will want to add a file called PortBindings.xml to your BTDF project and set the value of IncludeMessagingBindings to true.

  14. Modify the IncludeSSO value to be False. You may want to change this at a later stage but to get up and running lets switch it off.

That's it! Click the green arrow in the BTDF toolbar and the application should be deployed to your local BizTalk instance. Life is good!

BizTalk Done Right

I've been doing some consulting recently helping out a customer who are having a crack at their first BizTalk project. They've got a talented development team but no previous BizTalk experience so we're trying to ensure that not only do we achieve or immediate goals but also establish sustainable development practices which will keep their guys productive (and sane) in the years to come.

The slick demos and marketing spiel may have you believe that everything is easy with BizTalk – just drag this here, drop it there and you've got all your LOB systems integrated! The reality is that integration is not easy. It takes a while to figure the best ways of doing things; and in an environment where you’re wiring up disparate systems, you can be forced to live with your mistakes for a long time! You can’t just refactor/rename a schema you’ve published as a service and it usually doesn't go down to well if you ask the "other guys" to change their tested and currently working code because you finally figured out the right way to build that orchestration you deployed to production three months ago.

The intention of this series of blog posts is to share some of the lessons learned from the BizTalk projects I've been involved with over the years and hopefully save some of you out there some pain.

Hi

After years of procrastinating I’ve finally done it, and it only took a few hours. I’ve built a new blog site – yay! It looks like crap, the code is an abomination but hey, I’ve got something that works and I can always refactor it on a rainy day.

It’s too easy to fall into the trap of trying to make everything perfect when you’re working on personal projects. We tinker away adding feature after feature on our masterpieces that will never be finished.

If I get time I’ll add the ability for people to post comments, but as I had 4 comments in 6 years on the previous site I’m not going to be busting a gut to get it in.