Blog Home  Home Feed your aggregator (RSS 2.0)  
.Net Jonesie - Extending a Team Build
A simple programmers blog
 
# Friday, November 18, 2005
All my research and experimentation is starting to pay dividends.  I've managed to extend my Team Build to copy the project outputs from the drop location to a new folder structure and create an IIS virtual directory for the web service. 
 
So far, this is the steps I followed. 
 
Edit the TFSBuild.proj file
I added the following to the build:
 
  <PropertyGroup>
    <ClientDeploySource>$(DropLocation)\$(BuildNumber)\Debug</ClientDeploySource>
    <ServerDeploySource>$(DropLocation)\$(BuildNumber)\Debug\ PublishedWebsites\SUMSWS</ServerDeploySource>
    <ClientDeployDest>$(DropLocation)\test $(BuildNumber)</ClientDeployDest>
    <ServerDeployDest>$(DropLocation)\test $(BuildNumber)\SUMSWS</ServerDeployDest>
    <ServerLocalPath>D:\devweb\deployment\SUMS3\test $(BuildNumber)\SUMSWS</ServerLocalPath>

  </PropertyGroup>
  <UsingTask TaskName="Airways.Build.Tasks.IIS.CreateVDir" AssemblyFile="Airways.Build.Tasks.dll"/>
  <Target Name="AfterDropBuild">
    <CreateItem Include="$(ClientDeploySource)\*.dll">
      <Output TaskParameter="Include" ItemName="ClientDLLs"/>     
    </CreateItem>
    <CreateItem Include="$(ClientDeploySource)\*.exe">
      <Output TaskParameter="Include" ItemName="ClientEXEs"/>
    </CreateItem>
    <CreateItem Include="$(ClientDeploySource)\*.exe.config">
      <Output TaskParameter="Include" ItemName="ClientCONFIGs"/>
    </CreateItem>
    <CreateItem Include="$(ServerDeploySource)\**\*.*">
      <Output TaskParameter="Include" ItemName="ServiceFiles"/>
    </CreateItem>
    <!-- copy the client filed -->
    <Copy SourceFiles="@(ClientDLLs)" DestinationFolder="$(ClientDeployDest)" />
    <Copy SourceFiles="@(ClientEXEs)" DestinationFolder="$(ClientDeployDest)" />
    <Copy SourceFiles="@(ClientCONFIGs)" DestinationFolder="$(ClientDeployDest)" />
    <!-- copy the web service -->
    <Copy SourceFiles="@(ServiceFiles)" DestinationFiles="@(ServiceFiles->'$(ServerDeployDest)\%(RecursiveDir)%(Filename)%(Extension)')" />
   
    <!-- make the virtual dir -->
    <CreateVDir Server="localhost" Site="BSDTesting" PhysicalPath="$(ServerLocalPath)" VirtualPath="SUMSWS $(BuildNumber)" />
    <!-- create the test db ?? -->
    <!-- update the .config -->
    <!-- update the launcher XML file -->
   
  </Target>
The property group defines some source and destination folders.  These are based on the DropLocation which is defined at the top of the build file.  The destination folders for the client and server happen to be on the same machine to keep things simple, but these could (and probably should) be on another server.
 
Next, there is a new custom task I made for creating a virtual directory in IIS.  I search for a while without luck to find a built in solution for this or someone else's solution but in the end it was very easy and fun to create my own task.  My first attempt actually worked on the first execution!  Its not a very complete task - you can't do everything you might want to do with a VDIR but for me it's adequate.  If you want the code then shoot me an email or post a comment.  I had a look at .NET Solution Build, Deployment, Process & Tools but I found this too confusing at the time and thought it was easier and more enjoyable to create my own task.  Now I understand the process better I might take another look at this handy kit.
 
Next in the build file is a new Target.  This overrides the default AfterDropBuild target.  We need to use CreateItem as the items to be copied are produced by previous targets and don't exist when the build file is loaded.  If I had specified all the actual files by name rather than wildcard then I could have used an ItemGroup, but that would be tedious and error prone. The rest of the target is pretty self explanatory.
 
Checkin the TFSBuild and Custom Task
Once I made the changes I checked in the TFSBuild file and added the custom  task dll to the Team Build folder in Source Control.  When the Team Build executes, these files extracted to the build server so it's not necessary to put the custom task in the build server GAC or any such horrid stuff.
 
 
I've still a few more steps to complete before I can have new builds automatically published to users/testers but hopefully this will be as easy and fun as the rest of this.  I'll post an update when I've got the whole thing working.
Friday, November 18, 2005 12:18:15 PM (New Zealand Daylight Time, UTC+13:00)  #    Comments [2]   Team System  | 
Wednesday, April 12, 2006 8:07:20 PM (New Zealand Standard Time, UTC+12:00)
You know what? Using a web deployment project to build your web projects will save you the trouble of making a custom task do the deployment. Check out the tech notes section you refer to in another blog for info on how TB integrates with WDP. This might also help: http://blogs.msdn.com/anutthara/archive/2005/10/20/483091.aspx and http://blogs.msdn.com/anutthara/archive/2005/11/10/491409.aspx
Anutthara R Bharadwaj
Wednesday, June 28, 2006 4:35:47 PM (New Zealand Standard Time, UTC+12:00)
Have you found a built in task for CheckIn after build? I'd like to check in all binaries from the drop location into source control as a test for something? Any ideas?
Grant Smith
Comments are closed.
Copyright © 2012 Peter G Jones. All rights reserved.
DasBlog 'Portal' theme by Johnny Hughes.
Pick a theme: