1

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!

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.