在msdeploy中指定项目名称

con*_*tor 7 msbuild msdeploy command-line-arguments

我在一个解决方案中有两个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
Run Code Online (Sandbox Code Playgroud)

这按预期部署了一个项目.但是我如何部署另一个呢?在这个命令行中没有任何地方我指定了一个项目名称 - 为什么它选择一个项目来部署另一个项目?

理想情况下,我可以使用相同的命令部署两个项目,例如

...

    /p:Project=Project1
    /p:DeployIisAppPath=<SiteName>/Project1
    /p:Project=Project2
    /p:DeployIisAppPath=<SiteName>/Project2
Run Code Online (Sandbox Code Playgroud)

但我怀疑这是可能的.或者,我只想知道如何在命令行中指定项目名称.

Ser*_*kov 15

我认为将单个调用分为三个会更好:
- 构建sln;
- 部署site1;
- 部署site2;

msbuild.exe <solution>.sln
    /p:Configuration=<Release>
    /p:OutputPath=bin

msbuild.exe project1dir\proj1.csproj
    /p:Configuration=<Release>
    /p:OutputPath=<Path to common 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>/Project1
    /p:MSDeployPublishMethod=WMSVC

msbuild.exe project1dir\proj2.csproj
    /p:Configuration=<Release>
    /p:OutputPath=<Path to common 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>/Project2
    /p:MSDeployPublishMethod=WMSVC
Run Code Online (Sandbox Code Playgroud)