Archive

Archive for the ‘Biztalk 2010’ Category

Build Biztalk Deployment Framework Projects using TFS2010


The Biztalk Deployment Framework (BTDF) is a utility to help Biztalk administrators to easily output the Biztalk application, its components, configuration, and port bindings to an MSI package. Building Biztalk and BTDF projects can be automated using TFS Team Build because those projects are built using MSBuild. In TFS 2010, Microsoft changed the team build template from MSBuild configuration file to Workflow (WF4) activity. I have seen many posts asking how to use TFS Team Build to build BTDF projects but yet no one blogged about it. In this post, I will be modifying the default TFS2010 Team Build Template to support building BTDF msi packages.

Creating new Team Build Definition

  • Right click on one of the Teambuild definitions
  • Click New Build Definition

  • Enter the name of the build definition

  • Fill the Trigger, workspace and build default sections
  • Click on Process on the left
  • Click on Show Details
  • Click the New button
  • Click browse next to “Select the file to copy”
  • Select the Default Template, you can select the template you want to modify

  • Give it a name; I am naming it BTDFBuildProcessTemplate
  • Click Ok
  • In the Required group, click the ellipsis next to Items to Build
  • Add the solution you need to build which contains your Biztalk project(s)
  • Add the BTDF project you need to build, make sure that you switch the Items of type to *.*proj

  • Make sure that the solution is built first then the BTDFProj
  • Click the Configurations tab
  • My solution contains X86 and Any CPU projects, therefore I am choosing “Mixed Platforms”

  • Click OK
  • For this post, I am not running unit tests. Thus, I cleared the Automated Tests property
  • Change the MSBuild Platform to X86, otherwise Biztalk projects will fail

  • Save the build definition
  • Close the Team Build Definition.
  • Open Source Control from Team Explorer
  • Browse to the BuildProcessTemplates folder
  • Get latest version of the template we just created

Changes to the Default Template to Build Deployment Framework Projects

In this section, we will be modifying the workflow template we created in the previous section. Team build is different than building the solution from the visual studio. Team build creates two folders: one for the source files and one for the output called binaries. .btdfproj references biztalk dlls using a relative path which will be invalid when building the btdfproj using team build. We have two options, either to maintain the project structure and output the binaries to the source folder or add a condition to the .btdfproj to get the file from a different location when using Team Build. In this post, I will output the files into the bin folder in the source folder. This approach will affect your unit tests if you are running unit tests as team build checks the dlls in the binaries folder. It also affects copying the binaries to the drop folder. Another modification needs to be done to get this working. I will write another post to do such adjustment. The following steps adds activities to build the solutions and BTDF projects. The binaries of the projects will be output into the bin folder of each project in the source folder

  • Open the BTDFBuildProcessTemplate.xaml workflow xaml file created in the previous section
  • Click Collapse All

  • Expand On Agent

  • Expand the follow activities:
    • Try Compile, Test, and Associate Changesets and Work Items
    • Sequence
    • Compile, Test, and Associate Changesets and Work Items
    • Try Compile and Test
    • Compile and Test
    • For Each Configuration in BuildSettings.PlatformConfigurations
    • Compile and Test for Configuration
    • If BuildSettings.HasProjectsToBuild
    • For Each Project in BuildSettings.ProjectsToBuild
    • Try to Compile the Project
    • Compile the Project
  • Add a condition to check the type of the project to build by added an If activity between “Convert Server patch to Local” and “Run MSBuild for Project”

  • Drag and drop the “Run MSBuild for Project” to the Else section

  • In the If condition, check if the project extension is .btdfproj by entering the following condition:

IO.Path.GetExtension(localProject).Equals(“.btdfproj”)

  • Change the OutDir property to “” to output the binaries into the bin folder in the source directory. Thanks to Ajith  
  • Change the Display name of the if activity to something meaningful

  • If the project is a biztalk deployment framework project (*.btdfproj),
    • Add a new MSBuild activity to the If body, and rename it to Build BTDF Msi’s

  •  
    • Run msbuild (Build BTDF Msi’s activity) with the following arguments; we have set OutDir to “” to output the binaries into the source folder directory instead of the binaries folder.

  • Save the workflow and close it
  • Go to Source Control àBuildProcessTemplates
  • Checkin the workflow that was modified

  • Queue a new build
  • After the build is done, you will find the projects’ executables and BTDF msi in the bin folder of each project

Team Build: Could not find file ‘Microsoft.BizTalk.TOM.resources’ when running Biztalk Unit tests

February 15, 2011 1 comment

I have set up Team Build to build a solution that contains Biztalk and C# projects. The environment I used was Biztalk 2010 and TFS 2010. When running the unit tests related to Biztalk Schemas or Pipelines I used to receive the following exception:

Could not find file ‘Microsoft.BizTalk.TOM.resources’

I know that I have a reference to the Microsoft.BizTalk.TOM.dll assembly in the Biztalk project and the unit test project. Unit tests were running on Visual studio 2010 but failing on team build.

I figure out that for some reason, Team Build decides not to copy the Microsoft.BizTalk.TOM.dll assembly to the binaries folder of that unit test project although I have the “copy local” property set to true. To force deploying the assembly to the unit test folder, make sure that you add it to the testsetting deploy option. Make sure that Biztalk server is installed on the Teambuild machine and the path for the assembly is valid on the Teambuild server. Otherwise you need to checkin the assembly into source control and reference the assembly in source control. 

  1. Open the testsettings file used for the team build definition
  2. Click Deployment from the list on the left
  3. Click Add Files