Compsoft Flexible Specialists

Compsoft plc

Compsoft Weblog Compsoft Website News Archive Privacy Policy Contact Us  

Monday, June 01, 2009

Speeding up deployment by zipping drop files in TFS

As most of the projects we produce are web based, we use the file copy feature of ASP.NET heavily. It makes for wonderfully simple deployment. Using this feature does however mean that we zip the files up before sending them over to the live server.

To speed up deployment even further, we added a zip command to our build job in Team Foundation Server Build that zips the files in the drop location, ready for copy.

Zipping is not supported out of the box in TFS but the MSBuild Community Tasks Project has a lovely one.

To use the zip command in the community tasks library you need to add a reference to it.

<Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets"/>





Once this has been imported you can then use the zip command in your script. We tend to use the zip command in the AfterDropBuild event.



<CreateItem Include="$(DropLocation)\$(BuildNumber)\Release\**\*.*" Exclude="$(DropLocation)\$(BuildNumber)\Release\**\*.config">
<Output ItemName="ZipFiles" TaskParameter="Include" />
</CreateItem>

<Time Format="yyyy-MM-dd">
<Output TaskParameter="FormattedTime" PropertyName="buildDate" />
</Time>

<Zip Files="@(ZipFiles)" WorkingDirectory="$(DropLocation)\$(BuildNumber)\Release" ZipFileName="$(DropLocation)\$(BuildNumber)\NBR Release $(buildDate).zip" />





We also tend to put the date into the release and we do that by using the Time command. This now gives us a prepped zip file with all the release files in it.

0 Comments:

Post a Comment

<< Home