【问题标题】:Visual Studio 2012 Publish from command lineVisual Studio 2012 从命令行发布
【发布时间】:2014-02-02 19:53:48
【问题描述】:

我正在努力从命令行发布项目。以下是我采取的步骤:

  1. 创建了一个全新的ASP.NET MVC 3 (internet) project in Visual Studio 2012

  2. 使用发布向导添加了发布File System 配置文件并指定了目标目录。

  3. 点击发布成功将应用部署到指定位置。

  4. 添加了第二个发布配置文件,但这次是 Web Deploy 轮廓。指定服务器、站点名称、用户名和 我用来remote desktop 的帐户的密码 服务器。点击Validate Connection。它显示一个小“勾号” 表示成功的图片。

  5. 点击发布成功将应用部署到远程服务器。

总之,当我在 Visual Studio 中使用发布向导时,我可以成功地部署到本地文件系统或使用 Web 部署的远程服务器。

然后我切换到命令行

msbuild MyMVCProject.csproj /p:DeployOnBuild=true /p:PublishProfile=PublishToFileSystem.pubxml /p:VisualStudioVersion=11.0

成功部署到本地文件系统。

然而

msbuild MyMVCProject.csproj /p:DeployOnBuild=true /p:PublishProfile=BuildServer.pubxml /p:VisualStudioVersion=11.0 /p:AllowUntrustedCertificate=true

返回以下错误:

msdeploy error ERROR_USER_UNAUTHORIZED: Web deployment task failed. (Connected to the remote computer ("10.0.1.6") using the Web Management Service, but could not authorize. Make sure that you are using the correct user name and password, that the site you are connecting to exists, and that the credentials represent a user who has permissions to access the site. Learn more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_USER_UNAUTHORIZED.)

它在错误消息中提到的页面并没有真正帮助我。

谁能帮忙,为什么我可以从 Visual Studio 发布向导而不是从命令行部署而没有问题?

【问题讨论】:

    标签: visual-studio visual-studio-2012 msbuild


    【解决方案1】:

    结果证明解决方案非常简单。我只需要在命令行上添加/p:Password=<insert password here> 作为参数。我在publish 向导中提供了密码,但出于安全考虑,它没有存储在.pubxml 文件中。

    实际上,我是从SAYED IBRAHIM HASHIMI 的“补充”书中发现的。这本书的标题是Supplement to Inside the Microsoft Build Engine

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-08-25
      • 1970-01-01
      • 2010-10-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-08-26
      • 1970-01-01
      相关资源
      最近更新 更多