从 TeamCity 发布 vs2012 解决方案 [英] Publishing vs2012 solution from TeamCity

查看:26
本文介绍了从 TeamCity 发布 vs2012 解决方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Visual Studio 2012 和发布功能.我创建了一个发布配置文件,将我的应用程序部署到开发服务器,并且在我的机器上从 vs2012 执行时效果很好.这是我的问题;在开发服务器上,我还安装了 TeamCity,我想在构建完成后触发发布.所以我创建了一个简单的构建步骤,如下所示:

I'm using Visual Studio 2012 and the publishing feature. I have created a publishing profile that deploys my application to a development server, and it works great when executed from vs2012 on my machine. Here is my problem; on the development server I also have TeamCity installed and I would like to trigger the publishing after a build have completed. So I created a simple build step that looks like this:

Build file path: .\src\Solution.sln
Targets: Rebuild
Command line parameters: /p:DeployOnBuild=true;PublishProfile=Ci

执行此步骤时出现以下错误:

When this step is executing I get the following error:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets(4377, 5): error ERROR_USER_NOT_ADMIN: Web deployment task failed. 
(Connected to 'dev.domain.com' using the Web Deployment Agent Service, but could not authorize. Make sure you are an administrator on 'dev.domain.com'. 

Ci 配置文件包含一个用户名和密码,当我在我的机器上从 Visual Studio 运行发布时该用户名和密码有效.我还尝试在构建步骤中将用户名和密码作为参数传递,但得到了相同的结果.我是否需要在管理员帐户下运行 TeamCity 服务才能使其正常工作?感谢所有建议.

The Ci profile contains a username and password that works when I run the publishing from Visual Studio on my machine. I have also tried passing in username and password as parameters in the build step, but I get the same result. Do I need to run the TeamCity services under admin accounts to get this working? All suggestions are appreciated.

推荐答案

我刚刚在 http://sedodream.com/2013/01/06/CommandLineWebProjectPublishing.aspx.

你很接近,希望我能缩小差距.

You are pretty close, hopefully I can close the gap.

您在 VS 发布对话框中指定了用户名和密码是正确的,但我们没有将密码保存在 .pubxml 文件中.它当前保存在 .pubxml.user 文件中,该文件根本不用于命令行方案.因此,您需要传入该属性.所以在你的情况下应该是

You are correct that username and password are specified in the VS publish dialog, but we do not save the password in the .pubxml file. It is currently being saved in the .pubxml.user file, and that file is not used at all for command line scenarios. Because of that you will need to pass in the property. So in your case it should be

msbuild .\src\solution.sln /p:DeployOnBuild=true /p:PublishProfile=ci /p:Password=<insert-password>

如果您的 Web 服务器没有受信任的证书,您可能还需要传入 /p:AllowUntrustedCertificate=true.

If your web server does not have trusted certs you may need to also pass in /p:AllowUntrustedCertificate=true.

一个小补充,可能与您的问题没有直接关系,但可能对其稍后可能会看到的其他人有所帮助.如果您正在构建 .csproj/.vbproj 文件(并且可能在某些使用 .sln 文件的场景中),您应该传入属性 /p:VisualStudioVersion=11.0.有关更多信息,请访问我的博客 http://sedodream.com/2012/08/19/VisualStudioProjectCompatabilityAndVisualStudioVersion.aspx

One little addition which may not be directly related to your issue, but may be helpful for others which may see this later. If you are building the .csproj/.vbproj file (and potentially in some scenarios where the .sln file is used) you should pass in the property /p:VisualStudioVersion=11.0. More info on this available at my blog http://sedodream.com/2012/08/19/VisualStudioProjectCompatabilityAndVisualStudioVersion.aspx

这篇关于从 TeamCity 发布 vs2012 解决方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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