Compsoft Flexible Specialists

Compsoft plc

Compsoft Weblog Compsoft Website News Archive Privacy Policy Contact Us  

Monday, December 07, 2009

Using MSDeploy as a build task in TFS

MSDeploy is a new tool out by Microsoft that allows easy synching of files between servers. This can be used from inside IIS or just run from command line.

You can read more on MSDeploy here. Read MSDeploy's team blog. Nice article on using the msdeploy command line.

I thought I would share an actual use of the MSDeploy in our TFS build scripts. It also uses the XmlUpdate task from the MSBuild Community Tasks Project.

<Target Name="AfterDropBuild">

<!--
Update web.config to be in release mode -->
<XmlUpdate XPath="/configuration/system.web/compilation/@debug"
XmlFileName="$(DropLocation)\$(BuildNumber)\Release\_Published
Websites\Site\web.config
" Value="false" />

<BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Message="Deploying Website"
Condition="'$(IsDesktopBuild)'!='true'" >
<
Output TaskParameter="Id" PropertyName="InstallerStepId" />
</
BuildStep>

<
Exec
Command='"C:\Program Files\IIS\Microsoft Web Deploy\msdeploy.exe"
-verb:sync
-source:contentpath="$(DropLocation)\$(BuildNumber)\
Release\_PublishedWebsites\Site"
-dest:contentpath=\\SERVER\Websites\Site
'
ContinueOnError="false" />

<
BuildStep TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Id="$(InstallerStepId)"
Status="Succeeded"
Condition="'$(IsDesktopBuild)'!='true'" />

<
OnError ExecuteTargets="DeploymentFailed" />

</
Target>

<
Target Name="DeploymentFailed">
<!--
Called if deployment of the web site fails -->
<
BuildStep
TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
BuildUri="$(BuildUri)"
Id="$(InstallerStepId)"
Status="Failed"
Condition="'$(IsDesktopBuild)'!='true'" />
</
Target>

Labels: , , ,

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home