如何使用VS2010一键发布(MsDeploy)从命令行进行远程部署?
在远程 Web 服务器上,我安装了远程服务 http://xxxx/MsDeployAgentService。
如果我在 VS2010 中使用 Web 应用程序项目的发布命令,我可以成功发布到此远程 Web 服务器并更新特定的 IIS 网站。
我现在想做的是从命令行执行此功能。
我猜这是两步。首先使用相关的构建配置构建 Web 应用程序项目:
msbuild "C:\MyApplication\MyWebApplication.csproj"
/T:Package /P:Configuration=Release
然后发出 MsDeploy 命令以使其与删除的 IIS 服务器发布/同步:
msdeploy -verb:sync
-source:package="C:\MyApplication\obj\Release\Package\MyWebApplication.zip"
-dest:contentPath="My Production Website",
computerName=http://x.x.x.x/MsDeployAgentService,
username=adminuser,password=adminpassword
不幸的是,我收到错误:
错误:(10/05/2010 3:52:02 PM) 在远程计算机上处理请求时发生错误。
错误:源 (sitemanifest) 和目标 (contentPath) 对于给定操作不兼容。错误计数:1。
我已经为目标提供程序尝试了多种不同的组合,但没有任何乐趣:(
有人设法从命令行复制 VS2010 Web 应用程序项目“一键”发布吗?
On the remote web server I have installed the remote service http://x.x.x.x/MsDeployAgentService.
If I use the Web Application Project's Publish command in VS2010 I can successfully publish to this remote web server and update a specific IIS website.
What I want to do now is execute this capability from the command line.
I am guessing it is two steps. First build the web application project using the relevant build configuration:
msbuild "C:\MyApplication\MyWebApplication.csproj"
/T:Package /P:Configuration=Release
Then issue the MsDeploy command to have it publish/sync with the remove IIS server:
msdeploy -verb:sync
-source:package="C:\MyApplication\obj\Release\Package\MyWebApplication.zip"
-dest:contentPath="My Production Website",
computerName=http://x.x.x.x/MsDeployAgentService,
username=adminuser,password=adminpassword
Unfortunately I get an the error:
Error: (10/05/2010 3:52:02 PM) An error occurred when the request was processed on the remote computer.
Error: Source (sitemanifest) and destination (contentPath) are not compatible for the given operation. Error count: 1.
I have tried a number of different combinations for destination provider but no joy :(
Has anyone managed to replicate VS2010 Web Application Project "One Click" Publish from the command line?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想要做的是运行 /obj/release/package 文件夹中的 [项目名称].deploy.cmd 文件。
首先,在 Visual Studio 中,转到项目属性页,然后转到“打包/发布 Web”设置,选择“发布”配置,然后在“IIS 网站/应用程序名称”设置中定义内容路径。
现在运行与您正在使用的完全相同的 MSBuild 脚本,它将使用 /obj/release/package/[项目名称].SetParameters.xml 文件中定义的内容路径创建包。
最后一步只需在 /obj/release/package 文件夹中运行 [项目名称].deploy.cmd /Y /M:http://xxxx/MsDeployAgentService 即可。
这将使用所有适当的参数调用 MSDeploy。
What you want to do is run the [project name].deploy.cmd file in the /obj/release/package folder instead.
Firstly, in Visual Studio, go to the project properties page then down to the "Package/Publish Web" setting, choose your "Release" configuration then define your content path in the "IIS Web site/application name" setting.
Now run exactly the same MSBuild script you're already using and it will create the package with the content path defined in the /obj/release/package/[project name].SetParameters.xml file.
Final step is just to run [project name].deploy.cmd /Y /M:http://x.x.x.x/MsDeployAgentService in the /obj/release/package folder.
This invokes MSDeploy with all the appropriate parameters.