内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用
我正在使用VisualStudio 2012和发布功能。我已经创建了一个发布概要文件,将我的应用程序部署到开发服务器上,当在我的机器上执行VS 2012时,它工作得很好。这是我的问题;在开发服务器上,我还安装了TeamCity,我希望在构建完成后触发发布。因此,我创建了一个简单的构建步骤,如下所示:
Build file path: .\src\Solution.sln Targets: Rebuild Command line parameters: /p:DeployOnBuild=true;PublishProfile=Ci
当执行此步骤时,我得到以下错误:
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配置文件包含一个用户名和密码,当我在我的计算机上运行VisualStudio发布时,用户名和密码可以工作。我还尝试在构建步骤中将用户名和密码作为参数传递,但结果是相同的。我是否需要在管理帐户下运行TeamCity服务才能使其正常工作?
http://sedodre.com/2013/01/06/CommandLineWebProjectPublishing.aspx...
在VS发布对话框中指定用户名和密码是正确的,但我们不会将密码保存在.pubxml文件
msbuild .\src\solution.sln /p:DeployOnBuild=true /p:PublishProfile=ci /p:Password=<insert-password>
如果web服务器没有可信的证书,可能也需要传入/p:AllowUntrustedCertificate=true
...