concept custom task in category system administration

This is an excerpt from Manning's book Team Foundation Server 2008 in Action.
Team Build provides powerful tools to create an automated build process. You can create build projects using a wizard, directly from Team Explorer. Behind the scenes, Team Build generates an MSBuild project file and invokes MSBuild to perform the actual build. You can customize the build project file to override default targets and properties with your own implementation, create new targets and properties to meet your needs, or hook into the build process at various points to invoke custom logic. You can also tailor the overall build process for your unique scenario. For instance, you can create custom tasks to programmatically implement your custom logic in your favorite language. In addition to compiling the source code via MSBuild, Team Build downloads the latest files from Team Foundation version control (TFVC), labels the source files, stamps corresponding work items with the build number, produces build reports, and performs other housekeeping tasks. In this chapter, we look at selected business needs and how they can be achieved by extending Team Build. The goal is to create a build process that’s automated, reliable, repeatable, and maintainable.
In this section, we create a custom task named UpdateClickOnceLaunchPage to modify the publish.htm file generated by Visual Studio (see Listing 7.15).
Listing 7.16. Overriding AfterDropBuild to execute the custom task
<Target Name="AfterDropBuild" Condition=" '$(IsDesktopBuild)'!='true' " > <!-- Create ClickOnce publish html file --> <UpdateClickOnceLaunchPage PublishTemplateFile="@(TemplateFile)" StringToReplace ="{AssemblyVersion}" AssemblyVersion="$(MaxAssemblyVersion)" OutputFileCreationDirectory= "$(DropLocation)\$(BuildNumber)\ %(ConfigurationToBuild.FlavorToBuild)" /> <CreateItem Include="$(DropLocation)\$(BuildNumber)\**\*.*" > <Output ItemName="FilesToTouch" TaskParameter="Include" /> </CreateItem> <!-- Set standard modification time --> <Touch Time="12:00:00" Files="@(FilesToTouch)" > <Output TaskParameter="TouchedFiles" ItemName="FilesTouched"/> </Touch> <!-- Create ClickOnce files Item --> <CreateItem Include="$(DropLocation)\$(BuildNumber)\ %(ConfigurationToBuild.FlavorToBuild)\**\*.*" > <Output ItemName="ClickOnceFiles" TaskParameter="Include" /> </CreateItem> <!-- Copy ClickOnce related files to the publish directory --> <Copy SourceFiles="@(ClickOnceFiles)" DestinationFiles="@(ClickOnceFiles ->' $(PublishDir)\%(RecursiveDir)%(Filename)%(Extension)')" ContinueOnError="true" /> </Target>