在msdeploy中指定项目名称
我在一个解决方案中有两个 Web 项目,我想使用 msbuild 和 WebDeploy 来部署它们(这是通过 CI 服务器发生的)。
目前,我正在运行命令行:
C:\ProjectFolder>msbuild <solution>.sln
/p:Configuration=<Release>
/p:OutputPath=bin
/p:DeployOnBuild=True
/p:DeployTarget=MSDeployPublish
/p:MsDeployServiceUrl=https://<ServerUrl:port>/msdeploy.axd
/p:username=<user>
/p:password=<password>
/p:AllowUntrustedCertificate=True
/p:DeployIisAppPath=<SiteName>
/p:MSDeployPublishMethod=WMSVC
这将按预期部署一个项目。但我怎样才能部署另一个呢?在这个命令行中我没有指定项目名称 - 为什么它选择一个项目来部署另一个项目?
理想情况下,我能够使用相同的命令部署两个项目,例如
...
/p:Project=Project1
/p:DeployIisAppPath=<SiteName>/Project1
/p:Project=Project2
/p:DeployIisAppPath=<SiteName>/Project2
但我怀疑这是可能的。或者,我只想知道如何在命令行中指定项目名称。
I've got two web projects in one solution, and I'd like to deploy them both using msbuild and WebDeploy (this happens through a CI server).
Currently, I'm running a command line:
C:\ProjectFolder>msbuild <solution>.sln
/p:Configuration=<Release>
/p:OutputPath=bin
/p:DeployOnBuild=True
/p:DeployTarget=MSDeployPublish
/p:MsDeployServiceUrl=https://<ServerUrl:port>/msdeploy.axd
/p:username=<user>
/p:password=<password>
/p:AllowUntrustedCertificate=True
/p:DeployIisAppPath=<SiteName>
/p:MSDeployPublishMethod=WMSVC
This deploys one project, as expected. But how can I deploy the other as well? There's nowhere in this command line where I specified a project name - why did it choose one project to deploy over the other?
Ideally, I'd be able to deploy two project with the same command, something like
...
/p:Project=Project1
/p:DeployIisAppPath=<SiteName>/Project1
/p:Project=Project2
/p:DeployIisAppPath=<SiteName>/Project2
But I doubt that's possible. Alternatively, I just want to know how to specify a project name in the command line.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为最好将单个调用分成三个:
- 构建 sln;
- 部署站点1;
- 部署站点2;
I think it would be better to divide the single call to three:
- Build sln;
- Deploy site1;
- Deploy site2;
如果从项目的根文件夹运行命令行,并且不指定要生成的文件,则 msbuild 应自动选择该文件夹中的项目。
这将需要两个单独的命令行调用。
然后,您可以通过构建一个批处理文件来构建此批处理文件,该批处理文件依次 cd 到每个文件夹并单独运行 msbuild,或者同样为触发每个构建的 msbuild 构建您自己的 proj 文件。
抱歉,我目前无法在手机上制作示例!
If you run the command line from the projects' root folder(s), and don't specify a file to build, msbuild should automatically select the project in that folder.
This will require two separate command line calls, tho.
You can then build on this by building a batch file that cd's to each of the folders in turn and runs msbuild separately, or equally build your own proj file for msbuild that triggers each build.
Sorry I can't craft an example at the moment tho-on a phone!