TFS2010 构建定义部署到多台服务器? [英] TFS2010 Build Definition to Deploy to multiple servers?

查看:19
本文介绍了TFS2010 构建定义部署到多台服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在研究使用 MSDeploy 的 TFS2010 新的构建和部署功能.到目前为止,一切都很顺利(尽管很难找到有关特定场景的信息).

I've been looking into TFS2010 new build and deployment features with MSDeploy. So far everything is going well (although its been hard to find information about specific scenarios).

我可以修改我的构建定义以指定 2 个或更多服务器来部署吗?我需要做的是部署到多台服务器(因为我的测试环境中有两台使用 NLB).

Can I modify my Build Definition to specify 2 or more servers to deploy to? What I need to do is deploy to multiple servers (as I have two in my testing environment which uses a NLB).

我现在拥有的是一个构建定义,它构建、运行我的测试,然后部署到我的一个测试服务器(其中运行 MsDeployAgentService).它工作正常,并且每个 Web 项目都按照其项目文件中的配置进行部署.我使用的 MSBuild 参数是:

What I have now is a Build definition which Builds, runs my tests, and then Deploys to ONE of my testing servers (which has the MsDeployAgentService running on it). It works fine, and each web project is deployed as configured in its project file. The MSBuild Arguments I use are:

* /p:DeployOnBuild=True
* /p:DeployTarget=MsDeployPublish
* /p:MSDeployServiceURL=http://oawww.testserver1.com.au/MsDeployAgentService
* /p:CreatePackageOnPublish=True
* /p:MsDeployPublishMethod=RemoteAgent
* /p:AllowUntrustedCertificated=True
* /p:UserName=myusername
* /p:Password=mypassword 

注意:我不使用/p:DeployIISAppPath="xyz" 因为它不会部署我的所有项目并覆盖我的项目配置.

NB: I dont use /p:DeployIISAppPath="xyz" as it doesnt deploy all my projects and overrides my project config.

我可以添加另一个构建参数以使其调用多个 MSDeployServiceURL 吗?就像第二个/p:MSDeployServiceURL 参数指定另一台服务器一样?

Can I add another build argument to get it to call more than one MSDeployServiceURL? Like something like a second /p:MSDeployServiceURL argument that specifies another server?

还是我必须寻找其他解决方案,例如编辑 WF?

Or do I have to look for another solution, such as editing the WF?

我在 2 个月前在这里看到了一个几乎完全相同的问题:TFS 2010 - 构建后部署到多台服务器,所以看起来我不是唯一一个试图解决这个问题的人.

I saw an almost exact same question here posted 2 months ago: TFS 2010 - Deploy to Multiple Servers After Build , so it doesn't look like I'm the only one trying to solve this.

我还在讨论 MSDeploy 的 IIS.NET 论坛上发帖:http://forums.iis.net/t/1170741.aspx.它有相当多的观点,但同样没有答案.

I also posted on the IIS.NET forums where MSDeploy is discussed: http://forums.iis.net/t/1170741.aspx . It's had quite a lot of views, but again, no answers.

推荐答案

您不必两次构建项目即可部署到两台服务器.构建过程将构建一组部署文件.然后,您可以使用 InvokeProcess 部署到多个服务器.

You don't have to build the project twice to deploy to two servers. The build process will build a set of deployment files. You can then use the InvokeProcess to deploy to multiple servers.

首先创建一个名为 ProjectName 的变量.然后将分配"活动添加到编译项目"序列.它位于尝试编译项目"序列中.以下是分配的属性:

First create a variable named ProjectName. Then add an Assign activity to the "Compile the Project" sequence. This is located in the "Try to Compile the Project" sequence. Here are the properties of the Assign:

To: ProjectName
Value: System.IO.Path.GetFileNameWithoutExtension(localProject)

以下是部署到测试服务器的 InvokeProcess 活动的属性:

Here are the properties of our InvokeProcess activity that deploys to the test server:

Arguments: "/y /M:<server> /u:<domain><user> /p:<password>"
FileName: String.Format("{0}{1}.deploy.cmd", BuildDetail.DropLocation, ProjectName)

You will need to change <server>, <domain>, <user>, and <password> to the values that reflect your environment.

如果您需要手动部署到服务器,您可以从构建文件夹运行以下命令:

If you need to manually deploy to a server you can run the command below from your build folder:

deploy.cmd /y /M:<server> /u:<domain><user> /p:<password>

这篇关于TFS2010 构建定义部署到多台服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆