Tallan's Technology Blog

Tallan's Top Technologists Share Their Thoughts on Today's Technology Challenges

Executing a command during a BTDF Deployment or Undeployment

Kevin Morillo

Recently I came across the need to execute a command and script after a Biztalk deployment using the BizTalk Deployment Framework (BTDF).  In order to accomplish this BTDF allows the use of two specific deployment ‘Targets’ in the btdfproj file.  Each one will allow the execution of custom deployment or undeployment steps.  The ‘CustomDeployTarget’ tag allows for execution early on in the deployment process, while the ‘CustomUndeployTarget’ allows for execution early in the undeploy process.

In order to use either, you can add the following tags to the end of the btdfproj file after the <Target Name=”CustomRedist “></Target> element:

   1: <Import Project="$(DeploymentFrameworkTargetsPath)BizTalkDeploymentFramework.targets" />

   2:   <!--

   3:     The Deployment Framework automatically packages most files into the server install MSI.

   4:     However, if there are special folders that you need to include in the MSI, you can

   5:     copy them to the folder $(RedistDir) in the CustomRedist target.

   6:     To include individual files, add an ItemGroup with AdditionalFiles elements.

   7:   -->

   8:   <Target Name="CustomRedist">

   9:   </Target>

  10:   <Target Name="CustomDeployTarget">

  11:     <Exec Command="my_command_to_execute" />

  12:   </Target>

  13:   <Target Name="CustomUndeployTarget">

  14:     <Exec Command="my_command_to_execute" />

  15:   </Target>

  16: </Project>

Also, you can use the “BeforeTargets” and “AfterTargets” Target attributes to execute your target before or after a specific stage in the deployment or undeployment.

1 Comment. Leave new

[…] One of the greatest benefits is the ability to run custom deployment tasks and scripts.  In previous blogs we have shown how to run a custom post deployment scripts in BTDF, today, we will show how custom […]

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>