Customizing Deployments with Custom Targets

Parent Previous Next

The Deployment Framework for BizTalk contains a huge amount of functionality out of the box, but there are always cases where you need to modify or add your own customizations to the process.  There are many extensibility points built in to the Deployment Framework for just this reason.


NOTE: This topic applies mainly to BizTalk 2009 and earlier.  In MSBuild 4.0 (BizTalk 2010+), the Target element has new attributes BeforeTargets and AfterTargets that let you very precisely hook into the execution order.  See the MSBuild Target Build Order documentation for more.


Customizations are implemented via MSBuild targets in your deployment project file (.btdfproj).  Below you'll find a list of all possible target names and when they execute.  You must use the exact name specified here for your target to be recognized.  Place the Target element after the Import element.


Name

When

Description

CustomPreInitialize

Deploy; Undeploy

Runs at the absolute beginning of the process, before the Deployment Framework has done any initialization

CustomPostInitialize

Deploy; Undeploy

Runs just after the Deployment Framework has initialized itself by loading required MSBuild properties and exporting settings files from the settings spreadsheet

CustomPreExportSettings

Deploy; Undeploy

Runs just before the Deployment Framework exports settings files from the settings spreadsheet

CustomPostExportSettings

Deploy; Undeploy

Runs just after the Deployment Framework exports settings files from the settings spreadsheet

CustomDeployTarget

Deploy

Runs just after the Deployment Framework has initialized itself, preprocessed files with XmlPreprocess and prepared the bindings file and just before the empty BizTalk application is created

CustomPostDeployTarget

Deploy

Runs just after the Deployment Framework has deployed all artifacts and started the BizTalk application and just before the BizTalk hosts are restarted

CustomUndeployTarget

Undeploy

Runs just after the Deployment Framework has initialized itself and just before any undeployment steps occur

CustomPostUndeployTarget

Undeploy

Runs just after the Deployment Framework has undeployed all artifacts and just before the BizTalk hosts are restarted

CustomSSO

Deploy

Runs during SSO deployment, just after the settings file is imported into SSO

CustomPreRedist

MSI Build

Runs just after the Deployment Framework has initialized itself by loading required MSBuild properties

CustomRedist

MSI Build

Runs just after the Deployment Framework has finished copying files to the MSI staging folder ($(RedistDir)) and just before the MSI is built

CustomPostInstaller

MSI Build

Runs just after the MSI build has completed


Here's an example extension target that copies an entire folder of test files for inclusion into the MSI:


<Target Name="CustomRedist">

 <MakeDir Directories="$(RedistDir)\TestFiles" />


 <!-- Force MSBuild to expand the item spec into physical file specs -->

 <CreateItem Include="..\TestFiles\**\*.*">

   <Output TaskParameter="Include" ItemName="TestFilesSourceGroup" />

 </CreateItem>


<!-- Copy all of the files and subfolders from ..\TestFiles to $(RedistDir)\TestFiles -->

 <Copy DestinationFolder="$(RedistDir)\TestFiles\%(RecursiveDir)" SourceFiles="@(TestFilesSourceGroup)"/>

</Target>


Keep in mind that your deployment project file uses the MSBuild <Import> element to import the (large) BizTalkDeploymentFramework.targets file.  That file contains all of the "code" that makes the deployment process work.  If you are trying to understand exactly how the Deployment Framework for BizTalk implements a specific feature, or if you are looking for every available MSBuild property, that file should be your first stop.  It may be found in <ProgramFiles>\MSBuild\DeploymentFrameworkForBizTalk\5.0.


Created with the Personal Edition of HelpNDoc: Free PDF documentation generator