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>