如何获得TFS2010通过MSBUILD为我运行MSDEPLOY? [英] How can I get TFS2010 to run MSDEPLOY for me through MSBUILD?

查看:61
本文介绍了如何获得TFS2010通过MSBUILD为我运行MSDEPLOY?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Vishal Joshi上有一个很棒的PDC演讲此处,其中介绍了新的MSDEPLOY Visual Studio 2010中的功能-以及如何在TFS中部署应用程序. (来自 Scott Hanselman的演讲也很精彩,但他没有参加TFS).

There is an excellent PDC talk available here from Vishal Joshi which describes the new MSDEPLOY features in Visual Studio 2010 - as well as how to deploy an application within TFS. (There's also a great talk from Scott Hanselman but he doesn't go into TFS).

您可以在TFS2010中使用MSBUILD来调用MSDEPLOY,以将程序包部署到IIS.这是通过MSBUILD的参数完成的.

You can use MSBUILD within TFS2010 to call through to MSDEPLOY to deploy your package to IIS. This is done by means of parameters to MSBUILD.

该演讲解释了一些命令行参数,例如:

The talk explains some of the command line parameters such as :

/p:DeployOnBuild
/p:DeployTarget=MsDeployPublish
/p:CreatePackageOnPublish=True
/p:MSDeployPublishMethod=InProc
/p:MSDeployServiceURL=localhost
/p:DeployIISAppPath="Default Web Site"

但是该文档在哪里-我找不到任何文件?

我整天都在努力使它工作,但并不能完全正确,并最终会出现各种错误.如果我运行程序包的cmd文件,它将完美部署.如果我通过Visual Studio运行WebDeploy,它也可以完美运行.

I've been spending all day trying to get this to work and can't quite get it right and keep ending up with various errors. If I run the package's cmd file it deploys perfectly. If I run WebDeploy through Visual Studio it also works perfectly.

但是我想使用这些参数使整个部署通过msbuild运行,而不是单独调用msdeploy或运行包.cmd文件.我该怎么办?

But I want to get the whole deployment running through msbuild using these arguments and not a separate call to msdeploy or running the package .cmd file. How can I do this?

PS.是的,我确实正在运行Web Deployment Agent Service.我也有在IIS下运行的管理服务.我已经尝试过使用两者.

PS. Yes I do have the Web Deployment Agent Service running. I also have the management service running under IIS. I've tried using both.

我正在使用的args:

Args I'm using :

/p:DeployOnBuild=True 
/p:DeployTarget=MsDeployPublish 
/p:Configuration=Release 
/p:CreatePackageOnPublish=True  
/p:DeployIisAppPath=staging.example.com   
/p:MsDeployServiceUrl=https://staging.example.com:8172/msdeploy.axd 
/p:AllowUntrustedCertificate=True

给我:

C:\ Program Files(x86)\ MSBuild \ Microsoft \ VisualStudio \ v10.0 \ Web \ Microsoft.Web.Publishing.targets(2660):VsMsdeploy失败.(远程代理(URL https://staging.example.com:8172/msdeploy.axd?site=staging.example.com )联系.确保在目标计算机上安装并启动了远程代理服务.收到不支持的回复.响应标头"MSDeploy.Response"为",但应为"v1".远程服务器返回错误:(401)未经授权.

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets (2660): VsMsdeploy failed.(Remote agent (URL https://staging.example.com:8172/msdeploy.axd?site=staging.example.com) could not be contacted. Make sure the remote agent service is installed and started on the target computer.) Error detail: Remote agent (URL https://staging.example.com:8172/msdeploy.axd?site=staging.example.com) could not be contacted. Make sure the remote agent service is installed and started on the target computer. An unsupported response was received. The response header 'MSDeploy.Response' was '' but 'v1' was expected. The remote server returned an error: (401) Unauthorized.

推荐答案

IIS7 +相关答案....

好吧-这就是我最终要做的.或多或少,在此主题/问题中,按照 Simon Weaver 的帖子进行操作.

IIS7 + related answer ....

Ok - here's what I ended up doing. More or less, following the post by Simon Weaver in this thread/question.

但是涉及到MSBuild设置..大多数人在这里使用以下设置:/p:MSDeployPublishMethod=RemoteAgent对于IIS7是不正确.使用此设置意味着TFS尝试连接到URL:https://your-server-name/MSDEPLOYAGENTSERVICE但是要访问该URL,要进行身份验证的用户必须是Admin.哪个吓坏了. (并且您需要勾选Admin-override规则).我认为该网址适用于IIS6.

But when it comes to the MSBuild settings .. most people here are using following setting: /p:MSDeployPublishMethod=RemoteAgent which is NOT RIGHT for IIS7. Using this setting means TFS tries to connect to the url: https://your-server-name/MSDEPLOYAGENTSERVICE But to access that url, the user to authenticate needs to be an Admin. Which is fraked. (And you need to have the Admin-override rule thingy ticked). This url is for IIS6 I think.

当您尝试使用RemoteAgent连接时,这是标准错误消息:-

Here's the standard error message when you try to connect using RemoteAgent :-

C:\ Program文件 (x86)\ MSBuild \ Microsoft \ VisualStudio \ v10.0 \ Web \ Microsoft.Web.Publishing.targets (3588):Web部署任务 失败.(远程代理(URL http://您的网络服务器/MSDEPLOYAGENTSERVICE ) 无法联系.确保 已安装远程代理服务,并且 在目标计算机上启动.) 确保站点名称,用户名和 密码正确.如果问题是 尚未解决,请与您联系 本地或服务器管理员.错误 详细信息:远程代理(URL http://您的网络服务器/MSDEPLOYAGENTSERVICE ) 无法联系.确保 已安装远程代理服务,并且 在目标计算机上启动.一个 收到不支持的回复.这 响应头'MSDeploy.Response' 为"V1",但应为"v1".这 远程服务器返回错误:(401) 未经授权.

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets (3588): Web deployment task failed.(Remote agent (URL http://your-web-server/MSDEPLOYAGENTSERVICE) could not be contacted. Make sure the remote agent service is installed and started on the target computer.) Make sure the site name, user name, and password are correct. If the issue is not resolved, please contact your local or server administrator. Error details: Remote agent (URL http://your-web-server/MSDEPLOYAGENTSERVICE) could not be contacted. Make sure the remote agent service is installed and started on the target computer. An unsupported response was received. The response header 'MSDeploy.Response' was 'V1' but 'v1' was expected. The remote server returned an error: (401) Unauthorized.

所以..您需要将MSDeployPublishMethod更改为此:

So .. you need to change your MSDeployPublishMethod to this:

/p:MSDeployPublishMethod=WMSVC

WMSVC代表Windows Manager Service.基本上,它是Remote Agent上的较新包装,但现在允许我们更正用户名和密码..在此,用户不必是管理员! (高兴!)现在,您可以正确设置您希望每个网站访问..的用户.

The WMSVC stands for Windows Manager Service. It's basically a newer wrapper over the Remote Agent but now allows us to correct provide a user name and password .. where the user does NOT have to be an admin! (joy!) So now you can correct set which users u want to have access to .. per WebSite ..

它现在还尝试访问URL:https://your-web-server:8172/MsDeploy.axd<-这正是Visual Studio 2010 Publish窗口的作用! ((OMG-> PENNY DROPS!BOOM!)

It also now tries to hit the the url: https://your-web-server:8172/MsDeploy.axd <-- which is EXACTLY what the Visual Studio 2010 Publish window does! (OMG -> PENNY DROPS!! BOOM!)

这是我最终的MSBuild设置:

And here's my final MSBuild settings:

/p:DeployOnBuild=True
/p:DeployTarget=MSDeployPublish 
/p:MSDeployPublishMethod=WMSVC
/p:MsDeployServiceUrl=your-server-name
/p:DeployIISAppPath=name-of-the-website-in-iis7    
/p:username=AppianMedia\some-domain-user 
/p:password=JonSkeet<3<3<3
/p:AllowUntrustedCertificate=True

是否注意到用户名中包含域名?你需要那里.另外,在我的图片中,我允许我们的DOMAIN USERS访问该网站进行管理.因此,我添加的新用户帐户(TFSBuildService)具有Domain Users组的成员身份...这样便可以正常工作.

Notice the username has the domain name in it? Ya need that, there. Also, in my picture, I've allowed our DOMAIN USERS access to the website for managament. As such, my new user account i added (TFSBuildService) has Membership to the Domain Users group ... so that's how it all works.

现在-如果您已经阅读了所有这些内容,那就笑一笑(因为它们是SOOOOOOOO 2007)....

Now - if u've read all this, have a lolcat (cause they are SOOOOOOOO 2007)....

这篇关于如何获得TFS2010通过MSBUILD为我运行MSDEPLOY?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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