Search Wiki:

Installing and Configuring DelayedBuildTask

To install the DelayedBuildTask on your build server:
  1. Create a new folder where the build task files will be stored. By default, this should be: C:\Program Files\MSBuild\DelayedBuildTask. NOTE: If you change this path, you will need to modify the .targets file accordingly.
  2. Copy the files within the DelayedBuildTask folder from the "Cannot resolve link: [file:Binaries Only|DelayedBuildTask_-_Binaries_Only_v1.zip|]" download into the newly created folder. This folder should consist of four files, including:
    1. BuildQueuedNotification.html - this is the HTML template used when sending a notification that a build has been queued. This template can be modified based on your team's specific needs.
    2. BuildStartedNotification.html - this is the HTML template used when sending a notification that a previously queued build has been started. This template can be modified based on your team's specific needs.
    3. DelayedBuildTask.dll - this is the custom task assembly.
    4. DelayedBuildTask.targets - this is the custom tasks .targets file. This is the .targets file that will be imported into your build script(s). If you installed the custom build task to a folder other than the default folder listed above, you will need to modify the .targets file to reference the correct folder.

Installing and Configuring DelayedBuildWeb

The DelayedBuildTasks relies on a simple (single-page) web application to provide the ability to cancel a build. The web application consists of a single ASPX page that utilizes the Team Foundation Server Web Services API to cancel a build.

To setup the web application:
  1. Create a folder called DelayedBuildWeb (e.g. C:\Inetpub\wwwroot\DelayedBuildWeb).
  2. Copy the folders and files within the DelayedBuildWeb folder from the "Binaries Only" download into the newly created folder.
  3. Within the Web.config file, locate the value http://TFSSERVER:8080/build/v2.0/buildservice.asmx and replace "TFSSERVER:8080" with the address of your Team Foundation Server Application Tier. This is the address of the web services API used to manage builds.
  4. Within IIS Manager:
    1. Create an Application Pool and modify it to run under an account that has permissions to your Team Foundation Server (e.g. so that it can cancel builds).
    2. Convert the DelayedBuildWeb folder to a web application and set the Applicaton Pool to the one created above.

Modifying the Build Script to use DelayedBuildTask

To utilize the DelayedBuildTask within your build script:
  1. At the top of your TFSBuild.proj file, import the .targets file as follows: <Import Project="$(MSBuildExtensionsPath)\DelayedBuildTask\DelayedBuildTask.targets" />
  2. Override the desired target within your build script where you would like the delay to begin (and at which point you would like the e-mail notification to be sent out). Typically, this would be the target <BeforeEndToEndIteration>. Here is an example of an overridden target:

<!-- Delay the build and send out an e-mail notification with an option to cancel -->
<Target Name="BeforeEndToEndIteration">
<DelayedBuildTask ToAddress="John.Doe@MyCompany.com" 
                      SmtpServer="mail.MyCompany.com"
                      BuildUri="$(BuildUri)"
                      DelayedBuildWebUrl="http://TFSSERVER/DelayedBuildWeb"
                      
                      BuildProperties="{BuildType}=$(BuildDefinition)|{TeamProject}=$(TeamProject)|{ContactMe}=&lt;a href=&quot;mailto:John.Doe@MyCompany.com&quot;&gt;John Doe&lt;/a&gt;"
                      Delay="300"
                      SendSecondaryNotification="true"/>
</Target>
In this example, an e-mail message will be sent when a new build is queued and then a delay of 300 seconds (5 minutes) will occur unless the build is cancelled. See DelayedBuildTask Properties for a list of properties that can be passed into the build task.
Last edited Jul 23 2008 at 3:52 PM  by jbramwell, version 6
Updating...
Page view tracker