We take a slightly different approach to deploying with MSDeploy:
The output of the build creates a folder structure that includes:
- The zipped application files
- A .cmd file for deployment
- a SetParameters.xml file
It is the SetParameters file that really helps us out here. It looks like this:
<?xml version="1.0" encoding="utf-8"?>
<parameters>
<setParameter name="IIS Web Application Name" value="Default Web Site/blah-blah-sitename" />
</parameters>
In CARA. we have an action of type "Run Command Line" which simply runs this .cmd file with the "/Y" switch. (e.g. MySite.deploy.cmd /Y). This manages the intricacies of calling MSDeploy for us.
If you're wondering how this all gets created, in Jenkins we have a build job that uses MSBuild. It is run against the .Net web app project file from Visual Studio. Params for MSBuild look like:
/fl /v:diag /p:Configuration=Release /p:Platform="Any CPU" /p:OutputPath=${WORKSPACE}\Internal\BuildArtifacts /p:VisualStudioVersion=14.0 /p:DeployOnBuild=true /p:DeployTarget=Package /p:AutoParameterizationWebConfigConnectionStrings=false /p:DeployIISAppPath="Default Web Site/blah-blah-sitename" /p:PackageLocation=${WORKSPACE}\BuildArtifacts\_PublishedWebsites\MyWebApp_Package\MyWebApp.zip
You'll notice that the IIS Site Name is specified here, which in turn passes through to the SetParameters.xml file.
Hope this helps...