Thursday, May 07, 2009

In my new job, one of my functions is supporting Team Foundation Server for the development teams.  One of the first questions I have was a team that wants to have the Build server automatically copies the binaries from a build to their development server. 

First we must say that this task only can be done when the build is successful.

So I added following pieces of code to their build script before the SolutionToBuild part:
First I made a new property under the propertygroup node which contains the path to their destination server

<DestFolder><Put here your destination folder></DestFolder>

Next I use the AfterDropBuild, as this event is only fired when the build is succesfull.  So I override the AfterDropBuild target:

<Target Name="AfterDropBuild">
   <
Message Text="Copy to ontwikkel started!"/>
   <
CreateItem Include="$(BinariesRoot)\**\*.*" >
      <
Output ItemName="FilesToCopy" TaskParameter="Include" />
   </
CreateItem>
   <
Copy SourceFiles="@(FilesToCopy)"
            
DestinationFiles="@(FilesToCopy ->'$(DestFolder)\%(RecursiveDir)%(Filename)%(Extension)')" ContinueOnError="true" />
   <
Message Text="Copy to ontwikkel done!"/>
</
Target>

TFS
5/7/2009 12:58:47 PM (Romance Standard Time, UTC+01:00)  #     |