How I got Powershell and MS WebDeploy to play nice
For my current project I am working on, I am using the PSake build framework for Powershell. When I attempted to call the WebDeploy application to push it out to the server I was successful when the path did not have spaces it it, but on our build server (powered by Hudson) I couldn’t get it to work because of the spaces in our directory names. I was sort of boxed in because I cannot use relative paths in WebDeploy.
After spending a day trying to figure out how to escape the strings in the command line to get it to work, I finally decided to search on the error message. I came across this: “The Trials and Tribulations of Using MSDeploy with Powershell”.
I was able to get Powershell to build and deploy using the following code:
This pipes the output to the console so if it fails then it will show up when the output is emailed to the team.
Moral of this story: Powershell isn’t really a shell like bash, zsh, *sh in the UNIX world and the interpreter can get too greedy in parsing your commands.