How to call msdeploy.exe from teamcity

I want to add a predeploy step in my build, package and deploy build step. All I want is to take a backup of site that I am going to publish.


C:\Program Files\IIS\Microsoft Web Deploy>msdeploy.exe -verb:sync -source:iisApp
=G:\websites\test -dest:iisApp=g:\mybackup\3



For deployment I am using the following to do so.

/M /P:Configuration=%env.Configuration% /P:DeployOnBuild=True /P:DeployTarget=MSDeployPublish /P:MsDeployServiceUrl=%env.TargetServer%/MsDeployAgentService /P:DeployiisAppPath=%env.IISPath% /P:MSDeployPublishMethod=RemoteAgent /P:CreatePackageOnPublish=True /P:Username=%env.username% /P:Password=%env.password%

Now I am confused how to do all this in one step. Is it possible to do them together or do I need a separate step. How to do it from teamcity as I can do it fine locally on machine using msdeploy.exe
Please guide
4 comments
Comment actions Permalink

The only difference I see is error handling.
If you put the commands into separate build steps, then later steps are not executed if previous step fails.

0
Comment actions Permalink

Yes I am trying to do step 1 using command line using following command but getting errors.Any idea how to fix this

Runner Type: Command line
Command executable: msdeploy.exe  -verb:sync -source:runCommand='\\testServer02\G$\BackupStorage\BackupUsingMSDeploy.bat' -dest:auto,computername=testServer02

Please guide. as batch file on destination computer is successfully creating a backup but I am doing some syntax wrong while calling from teamcity.

0
Comment actions Permalink

What's the error?

0
Comment actions Permalink

Was running the executable from a wrong point. So running the command from Command executable: C:\Program Files\IIS\Microsoft Web Deploy V2\msdeploy.exe and then passing rest in parameters fixed the problem.

0

Please sign in to leave a comment.