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

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

问题描述

我一直在研究使用MSDeploy的TFS2010新版本和部署功能。到目前为止,一切顺利(尽管很难找到有关具体情况的信息)。



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



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

  * / 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,因为它没有部署我的所有项目并覆盖我的项目配置。



我可以添加另一个build参数让它调用多个MSDeployServiceURL?像一个第二个/ p:MSDeployServiceURL参数,指定另一个服务器?



或者我必须寻找另一个解决方案,如编辑WF?



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



我还发布在讨论MSDeploy的IIS.NET论坛上: http:/ /forums.iis.net/t/1170741.aspx 。它有相当多的意见,但再次没有答案。

解决方案

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



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

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

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

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

您将需要更改< server> ; domain>,< user>和< password>反映您的环境的价值观。

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

  deploy.cmd / y / M:< server> / U:其中结构域GT; \<使用者> / P:其中密码> 


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).

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).

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 

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

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?

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

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.

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.

解决方案

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.

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)

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天全站免登陆