Build and Deploy using MSBuild command-line tool

In this post, we will see how we can build and deploy a project using MSBuild with just one command.

I wrote how you can use MSBuild command-line tool to build your project in one my previous posts. However, we didn’t go through the deployment part. Let’s extend the build command to help us deploy once built is finished.

I am Using Build Tools for Visual Studio 2017, if you don’t have it you can download it here.

Here is the all-in one Build and Deploy msbuild command. You can extend it to your liking by adding more parameters.

msbuild YourProject.csproj /P:Configuration=Release /P:DeployOnBuild=True /P:DeployTarget=MsDeployPublish /P:MsDeployServiceUrl=https://yourserver-address/msdeploy.axd /P:AllowUntrustedCertificate=True /P:MSDeployPublishMethod=WMSvc /P:CreatePackageOnPublish=True /P:UserName=username /P:Password=password /P:DeployIISAppPath=""



Leave a Reply

Your email address will not be published. Required fields are marked *