How to deploy a project with msdeploy instead of msbuild

Today I use msbuild to deploy a web application on an iis server. How can I do the same with msdeploy (command line)?

MSBuild.exe myproject.csproj /P:VisualStudioVersion=11.0 /P:Password=pass /P:AllowUntrustedCertificate=true /P:DeployOnBuild=True /P:PublishProfile=deploytest /P:DeployIISAppPath="Default Web site" /P:MsDeployServiceUrl=my.server.com /P:Configuration=Release 
+7
msbuild webdeploy msdeploy
source share
1 answer

It depends on what you want your workflow to be, if you want to pack the result and deploy it separately, then you will need to create a zip file from your assembly.

Create package

Add the following command to the msbuild command line to create the package:

 /p:DeployTarget=Package /p:PackageLocation=MyProject.zip /p:CreatePackageOnPublish=True 

Expand package

 msdeploy.exe -verb:sync -source:Package=MyProject.Zip -destination:auto:ComputerName="my.server.com" 

You might also want to promote from one deployable site to another.

Site cloning

 msdeploy.exe -verb:sync -source:appHostConfig="my.server.com" -dest:appHostConfig="mynew.server.com" 

Or you may have a site that you want to target.

Cloning app

 msdeploy.exe -verb:sync -source:iisApp="my.server.com/MyApp" -dest:iisApp="my.server.com/MyNewApp" 
+14
source share

All Articles