如何从 VS2010 Web 部署进入命令行 msdeploy

发布于 2024-11-18 18:48:18 字数 989 浏览 8 评论 0原文

我有一个项目,可以从 VS2010 中部署到 4 个站点,其中 2 个使用基于文件的部署,2 个使用 Web 部署。

一个接一个地等待部署很无聊,所以我想自动化这一过程。在命令行上。

我了解 msdeploy,但我不知道如何告诉它 .Publish.xml 中的相同选项或让它使用保存在那里的设置。

我想要的是一个看起来像

msbuild Project.sln /p:Configuration=Config1
magicDeployingProgram Project.sln /p:PublishXMLConfigurationName="Server1DeploySettings"
msbuild Project.sln /p:Configuration=Config2
magicDeployingProgram Project.sln /p:PublishXMLConfigurationName="Server2DeploySettings"
msbuild Project.sln /p:Configuration=Config3
magicDeployingProgram Project.sln /p:PublishXMLConfigurationName="Server3DeploySettings"
msbuild Project.sln /p:Configuration=Config4
magicDeployingProgram Project.sln /p:PublishXMLConfigurationName="Server4DeploySettings"

或等效的批处理文件。我不介意重新指定 msdeploy 的设置,但是当我尝试此操作时,我找不到指定要部署到哪个 IIS 站点的选项(相当于发布设置对话框中的“站点/应用程序”框) vs2010)。

最后,我不介意它是否只是 Web 部署,我的基于文件的部署是懒惰的产物,我可以在适当的盒子上设置一个 Web 部署代理,我只是还没有这样做。

我一直在寻找有关这方面的信息,但我认为很难找到。

有什么指点吗?

I have a project which I can deploy to 4 sites from within VS2010, 2 using file based deployment and 2 using web deploy.

Its boring to sit through waiting for the deploys one after the other so I'd like to automate this. On the command line.

I know about msdeploy, but I can't see how to either tell it the same options which are in .Publish.xml or get it to use the settings which are saved there.

What I'd like is a batch file which looks something like

msbuild Project.sln /p:Configuration=Config1
magicDeployingProgram Project.sln /p:PublishXMLConfigurationName="Server1DeploySettings"
msbuild Project.sln /p:Configuration=Config2
magicDeployingProgram Project.sln /p:PublishXMLConfigurationName="Server2DeploySettings"
msbuild Project.sln /p:Configuration=Config3
magicDeployingProgram Project.sln /p:PublishXMLConfigurationName="Server3DeploySettings"
msbuild Project.sln /p:Configuration=Config4
magicDeployingProgram Project.sln /p:PublishXMLConfigurationName="Server4DeploySettings"

Or equivalent. I don't mind re-specifying the settings to msdeploy, but when I tried this I couldn't find the option to specify which IIS site to deploy to (the equivalent of the "Site/application" box on the publish settings dialog in vs2010).

Finally, I don't mind if it's web deploy only, my file-based deployment is a product of laziness, and I can set up a web deploy agent on the appropriate box, I just haven't had to yet.

I've been searching for information about this, but it's pretty hard to find, I think.

Any pointers?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

赴月观长安 2024-11-25 18:48:18

好吧,我想我已经找到了这个。 msbuild 可以做到。

C:\path\to\project>msbuild 
     /p:configuration="Config1" 
     /p:DeployOnBuild=True 
     /p:DeployTarget=MsDeployPublish 
     /p:CreatePackageOnPublish=True 
     /p:DeployIISAppPath="Default Web Site or whatever" 
     /p:MsDeployServiceUrl="http://machine/MSDEPLOYAGENTSERVICE"
     /p:AllowUntrustedCertificate=true 
     /p:UserName=DOMAIN\user
     /p:Password=thePassword
     /p:MsDeployPublishMethod=RemoteAgent 
     /p:SkipExtraFilesOnServer=true

x4 在批处理文件中。

Ok, I think I've found this. msbuild can do it.

C:\path\to\project>msbuild 
     /p:configuration="Config1" 
     /p:DeployOnBuild=True 
     /p:DeployTarget=MsDeployPublish 
     /p:CreatePackageOnPublish=True 
     /p:DeployIISAppPath="Default Web Site or whatever" 
     /p:MsDeployServiceUrl="http://machine/MSDEPLOYAGENTSERVICE"
     /p:AllowUntrustedCertificate=true 
     /p:UserName=DOMAIN\user
     /p:Password=thePassword
     /p:MsDeployPublishMethod=RemoteAgent 
     /p:SkipExtraFilesOnServer=true

x4 in a batch file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文