如何让 TFS2010 通过 MSBUILD 为我运行 MSDEPLOY?

发布于 08-28 15:18 字数 1981 浏览 16 评论 0 原文

Vishal Joshi 发表了一篇精彩的 PDC 演讲此处,其中介绍了 Visual 中的新 MSDEPLOY 功能Studio 2010 - 以及如何在 TFS 中部署应用程序。 (还有 Scott Hanselman 的精彩演讲,但他没有深入探讨 TFS)。

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

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

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

但是这方面的文档在哪里 - 我找不到任何文档?

我花了一整天的时间试图让它工作,但不能'没有完全正确,却总是以各种错误告终。如果我运行包的 cmd 文件,它就会完美部署。如果我通过 Visual Studio 运行 WebDeploy,它也可以完美运行。

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

附言。是的,我确实运行了Web 部署代理服务。我还在 IIS 下运行管理服务。我尝试过同时使用两者。


我正在使用的参数:

/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 < a href="https://staging.example.com:8172/msdeploy.axd?site=staging.example.com" rel="noreferrer">https://staging.example.com:8172/msdeploy.axd? site=staging.example.com)无法联系。请确保目标计算机上安装并启动了远程代理服务。)错误详细信息:远程代理(URL https://staging.example.com:8172/msdeploy.axd?site=staging.example.com) 无法联系。确保目标计算机上安装并启动了远程代理服务。收到了不支持的回复。响应标头“MSDeploy.Response”为“”,但预期为“v1”。远程服务器返回错误:(401) 未经授权。

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

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"

But where is the documentation for this - I can't find any?

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.

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

giving me :

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

完美的未来在梦里 2024-09-04 15:18:38

IIS7 + 相关答案...

好吧-这就是我最终所做的。或多或少,遵循Simon Weaver在此线程/问题中的帖子。

但是当涉及到 MSBuild 设置时..这里大多数人都使用以下设置:/p:MSDeployPublishMethod=RemoteAgent,这对于 IIS7 来说不正确。使用此设置意味着 TFS 尝试连接到以下 URL:https://your-server-name/MSDEPLOYAGENTSERVICE 但要访问该 URL,进行身份验证的用户必须是管理员。这是破碎的。 (并且您需要勾选“管理员覆盖规则”)。我认为这个网址适用于 IIS6。

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

标准 401 Frak Off uuck RemoteAgent,错误

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

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

/p:MSDeployPublishMethod=WMSVC

WMSVC 代表 Windows Manager Service。它基本上是远程代理的更新包装器,但现在允许我们正确提供用户名和密码..其中用户不必是管理员! (高兴!)所以现在您可以正确设置您想要访问的用户..每个网站..

在此处输入图像描述

它现在还尝试访问 URL:https://your-web-server:8172/MsDeploy.axd <-- 这正是 Visual Studio 2010 发布的内容 窗口确实如此! (天哪 -> PENNY DROPS!! BOOM!)

在此处输入图像描述

这是我的最终的 MSBuild 设置:

/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

注意到用户名中有域名吗?你需要那个,就在那里。另外,在我的图片中,我已允许我们的域用户访问该网站进行管理。因此,我添加的新用户帐户 (TFSBuildService) 具有 Domain Users 组的成员资格...这就是一切的工作原理。

现在 - 如果你已经阅读了所有这些,请拥有一个哈哈猫(因为它们是 SOOOOOOOO 2007 年)....

IIS7 + related answer ....

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

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.

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

Standard 401 Frak Off u suck RemoteAgent, error

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.

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

/p:MSDeployPublishMethod=WMSVC

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

enter image description here

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

enter image description here

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

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.

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

enter image description here

找回味觉 2024-09-04 15:18:38

这是最终对我有用的步骤。
我想与 RemoteAgent 一起使用,但无论我如何尝试都无法使其工作。

您不必完全这样做,但这就是我让它工作的方式

  • 配置 WMSVC
  • 确保服务已启动
  • 配置 IIS 用户(单击 IIS 中最顶层的服务器名称)并转到“IIS 管理器用户”。我建议将其设置为与您的 Windows 名称不同。
  • 确保 WMSVC 的用户帐户(对我来说是本地服务)对您正在使用的 IIS 目录具有写入权限。
  • 在我的例子中,我使用的是 SSL 证书(即使它访问的是 localhost)。

请记住,这些都是在 TFS 构建定义中添加的 MSBUILD 的所有参数

/p:DeployOnBuild=True 
/p:DeployTarget=MSDeployPublish 
/p:MSDeployPublishMethod=WMSVC 
/p:MsDeployServiceUrl=https://staging.example.com:8172/msdeploy.axd 
/p:username=sweaveriis 
/p:password=abcd1234 
/p:DeployIisAppPath=staging.example.com/virtual_directory_name
/p:AllowUntrustedCertificate=True

注意:staging.example.com 实际上是带有 hosts 文件 条目指向 127.0.0.1。本地主机可能也可以在这里工作。

有用的文章:

MSDeploy 问题疑难解答

更多疑难解答

Here's the steps that finally worked for me.
I wanted to get the working with RemoteAgent, but couldn't get that working no matter what I tried.

You don't have to do exactly like this, but this is how I got it working

  • Configure WMSVC
  • Make sure the service is started
  • Configure an IIS user (click on the TOP MOST SERVERNAME in IIS) and go to 'IIS Manager Users'. I suggest making it different to your windows name.
  • Make sure the user account for WMSVC (LOCAL SERVICE for me) has write permissions to the IIS directory you're using
  • In my case I'm using an SSL certificate (even though it is hitting localhost).

Remember these are all arguments to MSBUILD added within the TFS Build definition

/p:DeployOnBuild=True 
/p:DeployTarget=MSDeployPublish 
/p:MSDeployPublishMethod=WMSVC 
/p:MsDeployServiceUrl=https://staging.example.com:8172/msdeploy.axd 
/p:username=sweaveriis 
/p:password=abcd1234 
/p:DeployIisAppPath=staging.example.com/virtual_directory_name
/p:AllowUntrustedCertificate=True

Note: staging.example.com is actually the local box with a hosts file entry pointing to 127.0.0.1. Localhost would probably work here too.

Useful articles:

Troubleshooting MSDeploy issues

More troubleshooting

长安忆 2024-09-04 15:18:38

不幸的是,目前没有太多这方面的信息。不过,我会在本文末尾给您一些提示。


关于您的问题,当我尝试使用 MSDeploy 进行部署时,我之前已经看到过这种情况,并且我运行的帐户没有在目标计算机上执行部署的权限。因此,您需要查看运行构建的帐户,并查看该帐户是否有权部署到目标计算机。如果没有,那么你有几个选择;授予构建用户权限,或传递用户名/密码。

如果您想传递值,则必须定义一个名为 MsDeployDestinationProviderSetting 的项目,并且其元数据必须包含必要的值。

因此,在您的项目文件中(或通过传入的属性)定义如下内容。

<PropertyGroup>
    <UserName>USERNAME-HERE</UserName>
    <Password>PASSWORD-HERE
</PropertyGroup>

关于在哪里可以找到文档,就像我之前说过的,目前还没有太多。但由于整个 Web 发布管道都在 MSBuild 目标和任务中捕获,如果您熟悉 MSBuild,您可以自己学习很多东西。如果您查看使用 Visual Studio 2010 创建的 Web 项目的 .csproj(或 .vbproj)文件,您会注意到如下所示的语句:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

这将导入位于以下位置的文件 :
%ProgramFiles(x86)%\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets,此文件依次导入
%ProgramFiles(x86)%\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets

因此,为了立即详细了解此主题,您必须检查这些文件并为自己学习。


我将致力于研究一些详细介绍这些技术的东西,但它不会在很长一段时间内推出,而且我自己还有很多关于这些东西的东西需要弄清楚。

您可以尝试一下用户名/密码交易并告诉我它是否适合您吗?

Unfortunately there is not a lot of info on this at this time. I'll give you some hints at the end of this message though.


About your problem, I've seen this before when I was trying to deploy using MSDeploy and the account that I was running on didn't have the permissions to execute the deployment on the target machine. So you need to take a look at the account that your builds are running under, and see if this account has the rights to deploy to the target machine. If not then you have a few options; grant the build user the rights, or pass the username/password in.

If you want to pass the values in then you will have to define an item named MsDeployDestinationProviderSetting and its metadata will have to contain the necessary values.

So in your project file (or via properties passed in) define something like the following.

<PropertyGroup>
    <UserName>USERNAME-HERE</UserName>
    <Password>PASSWORD-HERE
</PropertyGroup>

About where can you find documentation, like I said before there is not much out there yet. But since the entire Web Publishing Pipeline is captured in MSBuild targets and tasks you can learn alot on your own if you are familiar with MSBuild. If you take a look at the .csproj(or .vbproj) files for web projects created with Visual Studio 2010 you'll notice a statement like the following:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />

This imports the file located at
%ProgramFiles(x86)%\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets, and this file in turn imports
%ProgramFiles(x86)%\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets

So in order to learn this topic in detail right now you have to inspect those files and learn for yourself.


I'm going to be working on something that will be covering these technologies in detail, but it won't be out for quite a while, and I still have a lot to figure out myself about this stuff.

Can you try out the username/password deal and let me know if it worked for you?

你是年少的欢喜 2024-09-04 15:18:38

我遇到了类似的问题,解决方案是使用以下参数:

/p:MSDeployPublishMethod=RemoteAgent

以下是我使用的所有参数。

/p:DeployOnBuild=True /p:DeployTarget=MSDeployPublish /p:MSDeployPublishMethod=RemoteAgent /p:MsDeployServiceUrl=http://my-server-name /p:username=myusername /p:password=mypassword

注意:我没有使用 DeployIisAppPath,因为我正在构建一个解决方案并尝试在以下位置构建三个 Web 应用程序:一次。另外,我认为您的 MsDeployServiceUrl 应该只是 http://staging.example.com

似乎在使用 InProc 时(对于 MSDeployPublishMethod,MSBuild 会忽略 MsDeployServiceUrl,并始终尝试部署到本地服务器(这可能是默认值)。我将其更改为 RemoteAgent,并且我的所有三个 Web 应用程序都部署成功。我确实注意到 Package 文件不再包含在 MyWebApplication_Package 文件夹中,但这对我来说不是什么大问题。

I had a similar problem and the solution was to have the following parameter:

/p:MSDeployPublishMethod=RemoteAgent

Here are all of the parameters I used.

/p:DeployOnBuild=True /p:DeployTarget=MSDeployPublish /p:MSDeployPublishMethod=RemoteAgent /p:MsDeployServiceUrl=http://my-server-name /p:username=myusername /p:password=mypassword

NOTE: I'm not using DeployIisAppPath because I'm building a solution and trying to build three web applications at once. Also I think your MsDeployServiceUrl should be just http://staging.example.com

It appears that when using InProc (which may be the default) for the MSDeployPublishMethod MSBuild ignores MsDeployServiceUrl and always tries to deploy to the local server. I changed it to RemoteAgent and all three of my web applications deployed successfully. I did notice that the Package file is nolonger contained in the MyWebApplication_Package folder, but that isn't a big deal to me.

驱逐舰岛风号 2024-09-04 15:18:38

请注意,您还可以设置 DeployTarget=Package ——这将准备包但不会立即部署它。有关详细信息,请参阅 这篇博文

Note that you can also set DeployTarget=Package -- this will prepare the package but not deploy it right away. For more info see this blog post.

乖不如嘢 2024-09-04 15:18:38

对我来说,问题是 Web 部署代理服务 未启动。

一个简单的net start msdepsvc修复了它。您还可以将此服务的启动模式设置为自动。

我使用的参数是:

/p:DeployOnBuild=True 
/p:DeployTarget=MsDeployPublish 
/p:MSDeployPublishMethod=RemoteAgent 
/p:MSDeployServiceUrl=stagingserver 
/p:DeployIisAppPath=test.local 
/p:UserName=

您只需要指定服务器名称,而不是完整路径(不需要 http)。

请注意,UserName 留空以解决 NTLM 身份验证的错误(这样它就使用 TFS 构建代理的凭据进行部署)。请参阅此处接受的答案

For me the problem was that Web Deployment Agent Service was not started.

A simple net start msdepsvc fixed it. You could also set startup mode to Automatic on this service.

The arguments I'm using are:

/p:DeployOnBuild=True 
/p:DeployTarget=MsDeployPublish 
/p:MSDeployPublishMethod=RemoteAgent 
/p:MSDeployServiceUrl=stagingserver 
/p:DeployIisAppPath=test.local 
/p:UserName=

You only need to specify the server name, and not the full path (no http needed).

Note that UserName is left empty to work around a bug with NTLM authentication (this way it uses the credentials of the TFS build agent for the deployment). see the accepted answer here

北风几吹夏 2024-09-04 15:18:38

这是我让它发挥作用的方法。这是 Webdeploy 2.0 的情况。我正在从我们的构建计算机到开发网络服务器计算机 Windows Server 2008 r2 的同一域上进行部署。我用来部署的帐户是域上的服务帐户,在两台计算机上都具有管理员权限。我的解决方案包括几个单元测试项目、一个 mvc3 项目和解决方案下的几个库。如果您没有在要部署的服务器上安装 MVC3,请查看 "="">http://www.iwantmymvc.com/2011-03-23-bin-deploy-aspnet-mvc-3-visual-studio 获取指导。

/p:DeployOnBuild=True /p:DeployTarget=MSDeployPublish /p:DeployIisAppPath="默认网站/YourpplicationNameHere" /p:MsDeployServiceUrl=https://devserver02:8172/msdeploy.axd /p:AllowUntrustedCertificate=True /p:UserName =yourDomain\buildaccount /p:Password=password

  1. 我最初遇到的问题是围绕“Default Web Site/YourpplicationNameHere”的引号,这给出了部分错误:

    MSBUILD:错误 MSB1008:只能指定一个项目。

    当默认网站/YourApplicationNameHere周围没有引号时会发生这种情况

  2. 我收到的下一个错误是因为我的部署凭据中的用户名和密码错误。它给出了这个错误:

    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets (3588): Web 部署任务失败。(远程代理(URL https://devserver02:8172/msdeploy.axd?site=Default 网站)。确保目标计算机上安装并启动了远程代理服务。)确保站点名称、用户名和密码正确。如果问题未解决,请联系您的本地或服务器管理员。错误详细信息:远程代理(URL https://devserver02:8172/msdeploy.axd?site=Default< /a> 网站)无法联系。确保目标计算机上安装并启动了远程代理服务。收到了不支持的回复。响应标头“MSDeploy.Response”为“”,但预期为“v1”。远程服务器返回错误:(401) 未经授权。

    这是因为 /p:UserName=/p:Password= 中的用户名和密码不包含该用户的域。即使构建在该用户下运行,它也不会部署。因此,我在浏览器中直接点击网址 https://devserver02:8172/msdeploy.axd 以确保这是操作并确保用户名和密码有效。在这里,我注意到我必须输入域/用户才能使其正常工作。

我希望这个回复没问题,我想其他一些可怜的灵魂也会发现这些错误,这可能会有所帮助......

Here's how I got it to work. This was with Webdeploy 2.0. I am deploying on the same domain from our build machine to a dev webserver machine windows server 2008 r2. The account I am using to deploy is a service account on the domain that has administrator permissions on both machines. My solution includes a couple of unit test projects, an mvc3 project, and a couple of libraries under the solution. If you don't install MVC3 on the server you are deploying to look at http://www.iwantmymvc.com/2011-03-23-bin-deploy-aspnet-mvc-3-visual-studio for guidance.

/p:DeployOnBuild=True /p:DeployTarget=MSDeployPublish /p:DeployIisAppPath="Default Web Site/YourpplicationNameHere" /p:MsDeployServiceUrl=https://devserver02:8172/msdeploy.axd /p:AllowUntrustedCertificate=True /p:UserName=yourDomain\buildaccount /p:Password=password

  1. The item I struggled with at first were the quotes around "Default Web Site/YourpplicationNameHere" That gives the partial error:

    MSBUILD : error MSB1008: Only one project can be specified.

    This happens when there are no quotes around Default Web Site/YourApplicationNameHere

  2. The next error I got was because of the wrong username and password in my credentials for deployment. It gave this error:

    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.targets (3588): Web deployment task failed.(Remote agent (URL https://devserver02:8172/msdeploy.axd?site=Default Web Site) 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 https://devserver02:8172/msdeploy.axd?site=Default Web Site) 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.

    This was because the username and password I had in /p:UserName=/p:Password=did not include the domain for the user. Even though it the build was running under that user it would not deploy. So I hit the url directly https://devserver02:8172/msdeploy.axd in a browser to make sure it was operation and make sure the username and password worked. This is where I noticed I had to put in the domain/user to get it to work.

I hope this is OK to reply I figured some other poor soul with find these errors and this could help...

北陌 2024-09-04 15:18:38

如果您可以使用 fileCopy 部署应用程序,则可以轻松自定义 TFS 工作流程来执行此操作。

我在以下文章的帮助下使用了 CopyDirectory 活动:

http://www.ewaldhofman.nl/post/2010/11/09/Part-14-Execute-a-PowerShell-script.aspx

http://geekswithblogs .net/jakob/archive/2010/09/01/tfs-team-build-2010-how-to-place-the-build-output.aspx

非常简单明了。

  • 我使用对所需共享具有写入权限的用户帐户配置了构建服务。

    我使用对所需共享具有写入权限的

  • 接下来,我创建了 CopyDirectory 工作流程步骤,将源配置为 BuildDetail.DropLocation +“_PublishedWebsites”,并为目标创建了一个参数,我将其称为“DeployPath”,可以在构建配置中填写该参数。

  • 现在我仍然需要实现一个测试,以在调用 CopyDirectory 活动之前检查构建是否成功。我提到的文章展示了如何做到这一点。他们还教授如何调用 powershell 脚本而不是 CopyDirectory。

If you can deploy your applications with fileCopy, it is easy to customize the TFS workflow to do so.

I've used the CopyDirectory activity, with the help of these articles:

http://www.ewaldhofman.nl/post/2010/11/09/Part-14-Execute-a-PowerShell-script.aspx

and

http://geekswithblogs.net/jakob/archive/2010/09/01/tfs-team-build-2010-how-to-place-the-build-output.aspx

Very simple and straightforward.

  • I Configured the build service with a user account that has write privileges on the desired share.

  • Next, I created the CopyDirectory workflow step, configuring the source as BuildDetail.DropLocation + "_PublishedWebsites" and for the destination I created an argument, which I called "DeployPath", that can be filled in the build configuration.

  • Now I still have to implement a test to check if the build was successful before invoking the CopyDirectory activity. The articles I mentioned show how to do that. They also teach how to invoke a powershell script instead of CopyDirectory.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文