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.
-
If you don't already have it, download BTDF from Codeplex.
-
Open up Visual studio and create a new blank solution called TransactionProcessing (this can be found in "Other Project Types, Visual Studio Solutions").
-
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.
-
Add a class library project to your solution called TransactionProcessing.Components.
-
Use the project properties tabs to make sure the output of each of your projects is signed with a strong name key file.
-
Change the assembly name and default namespace for each to include the MyCompany prefix – e.g. MyCompany.TransactionProcessing.Components etc.
-
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".
-
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.
-
Go to the TransactionProcessing.Deployment solution folder and rename the Deployment.btdfproj file to TransactionProcessing.Deployment.btdfproj.
-
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.
-
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> -
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.
-
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.
-
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!