Specifying a project name in msdeploy

I have two web projects in one solution, and I would like to deploy them using msbuild and WebDeploy (this happens through the CI server).

I am currently running the 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 both? There is nowhere on this command line where I indicated the name of the project - why did he choose one project to deploy on top of another?

Ideally, I could deploy two projects with the same team, something like

 ... /p:Project=Project1 /p:DeployIisAppPath=<SiteName>/Project1 /p:Project=Project2 /p:DeployIisAppPath=<SiteName>/Project2 

But I doubt it is possible. Also, I just want to know how to specify the project name on the command line.

+6
command-line-arguments msbuild msdeploy
source share
2 answers

I think it would be better to split one call into three:
- Build sln,
- Deployment of a site1,
- Deployment of a 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 
+14
source share

If you run the command line from the root folder (s) of the projects and do not specify the file to build, msbuild should automatically select the project in this folder.

This will require two separate command line calls, because

Then you can build on it, creating a batch file that connects to each of the folders, in turn, and launches msbuild individually or creates its own proj file for msbuild, which launches each assembly.

Sorry, I cannot create an example at the moment on the phone!

+1
source share

All Articles