2014-01-14 144 views
0

我努力从命令行发布项目。下面是我所采取的步骤:增加使用发布向导并指定目标目录中发布File System轮廓Visual Studio 2012从命令行发布

  1. 创建新ASP.NET MVC 3 (internet) project一个品牌 Visual Studio 2012

  2. 点击发布成功地将应用程序部署到指定的位置。

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

  4. 单击发布成功将应用程序部署到远程服务器。

因此,在总结,当我使用发布向导从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发布向导而不是从命令行部署问题?

回答

1

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

其实我从SAYED IBRAHIM HASHIMI的'补充'书中发现了这个。这本书的标题是Supplement to Inside the Microsoft Build Engine