We're calling a PowerShell script via TeamCity. We want to pass a parameter which contains quotes, e.g.:
Build step : PowerShell
Script file : foo/bar/my.ps1
Script arguments : -MyParam "%system.MyParam%"
Where system.MyParam
is set to <xml><elem attr="value"></elem></xml>
. Unfortunately, this fails with:
Cannot process argument transformation on parameter
MyParam
. Cannot convert value "<xml><elem
" to type "System.Xml.XmlDocument
". Error: "Unexpected end of file while parsing Name has occurred. Line 1, ..."
Anybody knows how to correctly pass double quotes?
What I've tried so far and didn't work:
- Simply passing the parameter
- Using double double quotes (i.e. attr=""value"")
- Using PowerShell's backtick escape mechanism (i.e. attr=`"value`")
- Using single quotes around the whole parameter (works only if value does not contain spaces)