I spent most of yesterday fighting against a combination of powershell and msdeploy.exe while trying to pass values to it containing embedded spaces.
I even tried using EchoArgs.exe to check if my parameters were being passed correctly, and they were!
I eventually reached the point where I began to question my own sanity in choosing software development as a career. That is until I tried a slightly different search in google and stumbled across an interesting blog post by James Coo.
Rather than calling msdeploy.exe I am now loading the assembly it uses and performing a sync …
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Deployment") $baseOptions = New-Object Microsoft.Web.Deployment.DeploymentBaseOptions $syncOptions = New-Object Microsoft.Web.Deployment.DeploymentSyncOptions $deploymentObject = [Microsoft.Web.Deployment.DeploymentManager]::CreateObject("contentPath", $sourceFolder) $deploymentObject.SyncTo("package", $packageName, $baseOptions, $syncOptions)
I hope this information will help someone else avoid insanity!