How to deploy after a build with TeamCity?

52,888

Solution 1

This article explains how to call Microsoft's WebDeploy tool from TeamCity to deploy a web application to a remote web server. I've been using it to deploy to a test web server and run selenium tests on check-in.

http://www.mikevalenty.com/automatic-deployment-from-teamcity-using-webdeploy/

  1. Install WebDeploy
  2. Enable Web config transforms
  3. Configure TeamCity BuildRunner
  4. Configure TeamCity Build Dependencies

The MSBuild arguments that worked for my application were:

/p:Configuration=QA  
/p:OutputPath=bin  
/p:DeployOnBuild=True  
/p:DeployTarget=MSDeployPublish  
/p:MsDeployServiceUrl=https://myserver:8172/msdeploy.axd  
/p:username=myusername  
/p:password=mypassword  
/p:AllowUntrustedCertificate=True  
/p:DeployIisAppPath=ci  
/p:MSDeployPublishMethod=WMSVC

Solution 2

I've written a pretty long blog post on this very topic that may interest you:

http://www.diaryofaninja.com/blog/2010/05/09/automated-site-deployments-with-teamcity-deployment-projects-amp-svn

basically:

  • install web deployment projects
  • add web deployment project to your solution
  • setup the solution configuration manager to have a "Deployment" build configuration
  • get team city to use this build switch when running the build
  • have a beer and wonder in glory at your automagical awesomenesss

Solution 3

We are using Octopus Deploy to manage our environments on top of Team city.

As a Build Process we have a Octopus Release and Octopus Deploy Creating a Release in Octupus which is then also automatically Deployed;

Since Octopus is managing our Environments it also provided variables which we use extensively and can use the same build to create a new environment all together.

Solution 4

Typically what I do is to create a Wix installer. A Wix project can be build with MsBuild so you should have no problems there.

Also I would recommend looking at the following MsBuild extensions for the automated deployment:

http://www.codeplex.com/MSBuildExtensionPack
http://msbuildtasks.tigris.org/

I hope this helps.

Solution 5

Please also consider a Deployer plugin from one of the TeamCity developers: http://confluence.jetbrains.com/display/TW/Deployer+plugin

Share:
52,888

Related videos on Youtube

Neil N
Author by

Neil N

Boom.

Updated on July 05, 2022

Comments

  • Neil N
    Neil N almost 2 years

    I'm setting up TeamCity as my build server.

    I have my project set up, it is updating correctly from subversion, and building ok.

    So what's next?

    Ideally, I'd like to have it auto deploy to a test server, with a manual deploy to a live/staging server.

    What's the best way to go about this?

    Since I am using C#/ASP.Net, should I add a Web Deployment project to my solution?

    • Karl Harnagy
      Karl Harnagy almost 11 years
      Have you seen Inedo's BuildMaster? A common workflow I see is to have build artifacts pulled out of TeamCity, and deployed/configured with BuildMaster to various servers. Quick reference article: inedo.com/support/kb/1031/… (disclaimer: I work for Inedo)
    • Damon
      Damon over 10 years
      I made a similar recommendation before, but I do not work for Inedo. It's worth looking at.
  • user384080
    user384080 over 10 years
    how do i set email notification once the deployment complete?
  • Nevin Raj Victor
    Nevin Raj Victor almost 9 years
    @Michael Valenty: I tried the given solution asMSBuild.exe C:\BuildAgent\work\4c7b8ac8bc7d723e\WebService.sln /p:Configuration=Release /p:OutputPath=bin /p:DeployOnBuild=True /p:DeployTarget=MSDeployPublish /p:MsDeployServiceUrl=https://204.158.674.5/msdeploy.axd /p:username=Admin /p:password=Password#321 /p:AllowUntrustedCertificate=True /p:DeployIisAppPath=Default WebSite/New /p:MSDeployPublishMethod=WMSVC. It gives me an error ` MSBUILD : error MSB1008: Only one project can be specified. Switch: WebSite/New`
  • enorl76
    enorl76 over 6 years
    note, this answer no longer relevant for vs2013+ since they removed Web Deployment Projects
  • duct_tape_coder
    duct_tape_coder about 4 years
    The Deployer plugins are now integrated into TeamCity 10+