I am trying to deploy a website via the Web Deploy API (Microsoft.Web.Deployment).
Using the msdelpoy.exe, I could do as many -postSync:runcommand's (or preSync) as I like, but I can't see how to do that via the API.
Here is my deployment script in powershell, but you can see the .net classes being used.
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Deployment")
function CallMSDeploy([string]$destinationServer, [string]$destinationIISSiteName, $sourceDirectory)
{
$destBaseOptions = new-object Microsoft.Web.Deployment.DeploymentBaseOptions
$destBaseOptions.UserName = $deployUserName
$destBaseOptions.Password = $deployPassword
$destBaseOptions.ComputerName = $destinationServer
$syncOptions = new-object Microsoft.Web.Deployment.DeploymentSyncOptions
$deploymentObject = [Microsoft.Web.Deployment.DeploymentManager]::CreateObject("contentPath", $sourceDirectory)
$deploymentObject.SyncTo("contentPath",$destinationIISSiteName,$destBaseOptions,$syncOptions);
}
I know that I can new up a Microsoft.Web.Deployment.DeploymentObjectProvider using the "runCommand" provider and specifiy a path, but how do I add it to the preSync of the above deployment?
Thanks in advance!
preSync
/ postSync
is a feature of the msdeploy command line, not the Microsoft.Web.Deployment
API itself. Both are basically just a call to CreateObject().SyncTo(destOptions)
, where destOptions
are copied from the main sync.
You should have no troubles reproducing it in PS.