TFS 2010 Build and Deploy with Web Deploy

It hasn’t been until recently that I’ve messed around with some of the web application deployment tools Visual Studio and TFS have to offer.  So I started with the one click publish which you can find in Visual Studio when you have your web application highlighted.  It’s really cool that you can deploy to a web server directly from Visual Studio, but what’s even cooler is that you can utilize the same process in a TFS build with little work at all!  Below shows the simple steps to creating a build definition that will deploy your web application.

1.  Install Web Deploy on the IIS server you wish to deploy to. for x86 or for x64.  This is used to remotely install you web application and configure any IIS settings.  NOTE:  I recently ran into some issues with installing this where it doesn’t install all the necessary components.  If you reinstall it and select Change, you may find that all component where not installed.  If you are running into issues with permissions during web deploy see this thread

2.  Create a new build definition.  This can be found on the Team Explorer windows, and right clicking the Builds folder.

3.  Set a drop location for the build output.


4.  Set the following MSBuild Arguments. These are required for the web deploy build target. These are space separated build parameters. Four of them you must provide information for.  If you don’t provide information about username password, I believe it will use the build agent’s process identity.






/p:MsDeployServiceUrl={You IIS Server Running Web Deploy Agent}



{Site/application} – the web sites name of application name under the site. An example of just the site would be “Default Web Sites”, or in the case of a application under a site then “Default Web Sites/MyApp”.

{You IIS Server Running Web Deploy Agent} – the server name of IP address of the IIS server that your deploying to. It will be running the Web Deploy Agent service.  For example, http://MyIISMachine or

{Username} – a username that has sufficient privileges on the report IIS server copy content and modify IIS metabase.

{Password} – password for the user


5.  You might have to place the build agent account in the Adminstrators group on the machine being deployed to.

6.  Save you build definition.  Now queue it and watch it run.

See also my post on Configure Click-Once Publisher in Visual Studio.

No comments: