msdeploy.exe pushed me to the brink of insanity before powershell saved my life!

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 …

	$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!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s