C# 如何在使用 TeamCity 构建后进行部署?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1987507/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to deploy after a build with TeamCity?
提问by Neil N
I'm setting up TeamCity as my build server.
我正在将 TeamCity 设置为我的构建服务器。
I have my project set up, it is updating correctly from subversion, and building ok.
我已经设置了我的项目,它正在从 subversion 正确更新,并且构建正常。
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?
由于我使用的是 C#/ASP.Net,我应该在我的解决方案中添加一个 Web 部署项目吗?
采纳答案by Mike Valenty
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.
本文介绍了如何从 TeamCity 调用 Microsoft 的 WebDeploy 工具将 Web 应用程序部署到远程 Web 服务器。我一直在使用它来部署到测试 Web 服务器并在签入时运行 selenium 测试。
http://www.mikevalenty.com/automatic-deployment-from-teamcity-using-webdeploy/
http://www.mikevalenty.com/automatic-deployment-from-teamcity-using-webdeploy/
- Install WebDeploy
- Enable Web config transforms
- Configure TeamCity BuildRunner
- Configure TeamCity Build Dependencies
- 安装 WebDeploy
- 启用 Web 配置转换
- 配置 TeamCity BuildRunner
- 配置 TeamCity 构建依赖项
The MSBuild arguments that worked for my application were:
适用于我的应用程序的 MSBuild 参数是:
/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
回答by Burt
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.
通常我所做的是创建一个 Wix 安装程序。可以使用 MsBuild 构建 Wix 项目,因此您应该没有问题。
Also I would recommend looking at the following MsBuild extensions for the automated deployment:
此外,我建议查看以下用于自动部署的 MsBuild 扩展:
http://www.codeplex.com/MSBuildExtensionPack
http://msbuildtasks.tigris.org/
http://www.codeplex.com/MSBuildExtensionPack
http://msbuildtasks.tigris.org/
I hope this helps.
我希望这有帮助。
回答by Doug
I've written a pretty long blog post on this very topic that may interest you:
我写了一篇关于这个主题的很长的博客文章,你可能会感兴趣:
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
- 安装 Web 部署项目
- 将 Web 部署项目添加到您的解决方案中
- 设置解决方案配置管理器以具有“部署”构建配置
- 在运行构建时让团队城市使用这个构建开关
- 喝杯啤酒,惊叹于你的自动魔法
回答by KIR
Please also consider a Deployer plugin from one of the TeamCity developers: http://confluence.jetbrains.com/display/TW/Deployer+plugin
还请考虑来自 TeamCity 开发人员之一的 Deployer 插件:http: //confluence.jetbrains.com/display/TW/Deployer+plugin
回答by Amit
We are using Octopus Deployto manage our environments on top of Team city.
我们正在使用Octopus Deploy在 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;
作为构建过程,我们有一个 Octupus 发布和 Octupus 部署,在 Octupus 中创建一个发布,然后它也会自动部署;
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.
由于 Octopus 正在管理我们的环境,它还提供了我们广泛使用的变量,并且可以使用相同的构建来一起创建一个新环境。