I’ve been looking around the new project system introduced in the BizTalk Server 2009
beta. As you might have heard before, it’s now based on MSBuild. This is an extremely
welcome change from the obscure compilation model in previous BizTalk versions that
caused so much frustration.

BizTalk Projects now look much like regular C# projects (they even have the same icon
in solution explorer) but they can contain BizTalk artifacts like schemas, orchestrations,
maps and pipelines.

Opening up the .btproj file reveals some of the differences and custom
MSBuild tasks used by the new BizTalk project system. Two things are initially important
to mark an MSBuild file as a BizTalk project.

The first one is the <ProjectTypeGuids/> value:

<ProjectTypeGuids>{EF7E3281-CD33-11D4-8326-00C04FA0CE8D};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

This means:

  • {EF7E3281-CD33-11D4-8326-00C04FA0CE8D}: This represents the
    BizTalk project factory, and tells VS where to find the item templates for BizTalk
    artifacts and so on.

  • {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}: This represents the
    C# project system.

So, in fact, a BizTalk Project is a C# project. Right now you can’t add C#
artifacts to the project without editing the .btproj file by hand, but
one can hope this will be supported in upcoming builds.

The second part important to making a .btproj is importing the BizTalk
MSBuild tasks, which is accomplished by this line:

<Import Project="$(MSBuildExtensionsPath)\Microsoft\BizTalk\BizTalkC.targets" />

If we look at the BizTalkC.targets file, we can see that the BizTalk MSBuild tasks
are implemented in the Microsoft.VisualStudio.BizTalkProject.BuildTasks assembly,
which you’ll find in your ‘Microsoft BizTalk Server 2009\Developer Tools’ folder.

Global Project Properties

There are several properties that will get set in the project files depending on your
project settings that are BizTalk-specific:

  • <BpelCompliance/>: This is a Boolean (true, false) property
    that indicates if the generated assembly should be marked as BPEL compliant (I think).

  • <EnableUnitTesting/>: Corresponds to the Enable Unit Testing
    option in the Deployment tab of the project settings dialog, and controls whether
    the unit testing features for
    pipelines, schemas and maps are enabled.

Other settings are per-user settings and stored in the .btproj.user file:

  • <Server/>: The name of the SQL Server instance that has
    the BizTalk databases for deployment.

  • <ConfigurationDatabase/>: The name of the BizTalkMgmt
    database.

  • <ApplicationName/>: The name of the BizTalk application
    you want to deploy to.

  • <Redeploy/>: Boolean property that indicates if you want
    to allow redeployments from within Visual Studio.

  • <RestartHostInstance/>: If true, the BizTalk hosts will
    be restarted after each deployment.

  • <Register/>: If true, the generated assembly will be registered
    in the Global Assembly Cache (GAC).

Per-File Project Properties

The per-user project file (.btproj.user) can also include a bunch of item-specific
properties, which are visible when you select a file in Solution Explorer and open
the Properties window.

In this category you’ll find properties for setting paths for map input and output
files for testing/debugging as well as paths for input and output files for testing
schemas.

Here’s an example:

<File Path="E:\Projects\BizTalk\PipelineTesting\SampleSchemas\Map1.btm">

   <ValidateTestMapInput>True</ValidateTestMapInput>

   <ValidateTestMapOutput>True</ValidateTestMapOutput>

   <TestMapInputInstanceFilename></TestMapInputInstanceFilename>

   <TestMapOutputInstanceFilename></TestMapOutputInstanceFilename>

   <TestMapSourceType>0</TestMapSourceType>

   <TestMapTargetType>0</TestMapTargetType>

   <EditorOutputInstanceFilename></EditorOutputInstanceFilename>

   <EditorInputInstanceFilename></EditorInputInstanceFilename>

   <GenerateInstanceOutputType>0</GenerateInstanceOutputType>

   <ValidateInstanceInputType>0</ValidateInstanceInputType>

   <PropertySchemaFileName>PropertySchema.xsd</PropertySchemaFileName>

   <AutoRefreshSchema>0</AutoRefreshSchema>

</File>

<File Path="E:\Projects\BizTalk\PipelineTesting\SampleSchemas\NoNS.xsd">

   <ValidateTestMapInput>True</ValidateTestMapInput>

   <ValidateTestMapOutput>True</ValidateTestMapOutput>

   <TestMapInputInstanceFilename></TestMapInputInstanceFilename>

   <TestMapOutputInstanceFilename></TestMapOutputInstanceFilename>

   <TestMapSourceType>0</TestMapSourceType>

   <TestMapTargetType>0</TestMapTargetType>

   <EditorOutputInstanceFilename></EditorOutputInstanceFilename>

   <EditorInputInstanceFilename></EditorInputInstanceFilename>

   <GenerateInstanceOutputType>0</GenerateInstanceOutputType>

   <ValidateInstanceInputType>0</ValidateInstanceInputType>

   <PropertySchemaFileName>PropertySchema.xsd</PropertySchemaFileName>

   <AutoRefreshSchema>0</AutoRefreshSchema>

</File>

Building Pipelines

To build a pipeline, you can use the PipelineCompilerTask:

<ItemGroup>

   <Pipeline Include="CSV_FF_RecvPipeline.btp">

      <Namespace>SampleSchemas</Namespace>

      <TypeName>CSV_FF_RecvPipeline</TypeName>

   </Pipeline>

</ItemGroup>

Building Schemas

BizTalk Schemas can be compiled using the new SchemaCompiler task:

<ItemGroup>

   <Schema Include="Schema1_NPP.xsd">

      <Namespace>SampleSchemas</Namespace>

      <TypeName>Schema1_NPP</TypeName>

   </Schema>

</ItemGroup>

Building Maps

BizTalk Maps can be compiled using the new MapperCompiler task:

<ItemGroup>

   <Map Include="Map1.btm">

      <TypeName>Map1</TypeName>

      <Namespace>SampleSchemas</Namespace>

      <SubType>Task</SubType>

   </Map>

</ItemGroup>

I’m not sure yet what the <Subtype/> element does.

Building Orchestrations

BizTalk Orchestrations can be built with the new XLangTask:

<ItemGroup>

   <XLang Include="BizTalk
Orchestration1.odx"
>

      <TypeName>BizTalk_Orchestration1</TypeName>

      <Namespace>SampleSchemas</Namespace>

      <SubType>Task</SubType>

   </XLang>

</ItemGroup>

<ItemGroup>