如何在使用 TeamCity 进行构建后进行部署?

我将 TeamCity 设置为构建服务器。

我有我的项目设置,它是正确的更新从颠覆,并建立确定。

接下来呢?

理想情况下,我希望将它自动部署到测试服务器,并将手动部署到活动/登台服务器。

最好的办法是什么?

因为我使用的是 C #/ASP.Net,我是否应该在解决方案中添加一个 Web 部署项目?

53574 次浏览

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.

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

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

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

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.