Using MSDeploy as a build task in TFS

Monday, December 07, 2009

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>

Find out more about by contacting us

  • Software Developer Vacancy

    06 Aug 2010
    Software Developer Vacancy

    Compsoft plc, an established, leading provider of bespoke web-based and mobile application development is seeking an experienced OO developer to join our busy team based in Alton, Hampshire.

  • Golf Coach is Featured by Apple

    21 Jun 2010
    Golf Coach is Featured by Apple

    Everyday Golf Coach HD is featured by Apple on the iTunes Store as 'New and Noteworthy'.

  • Daler-Rowney shows off art supplies

    08 Jun 2010
    Daler-Rowney shows off art supplies

    Compsoft develops iPhone app for leading art materials supplier Daler-Rowney.

  • Compsoft attends WWDC 2010 in San Francisco

    07 Jun 2010
    Compsoft attends WWDC 2010 in San Francisco

    Compsoft has sent some of its developers over to the top Apple development event of the year - the Worldwide Developer Conference (WWDC) 2010 in San Francisco, California.