C# 从TeamCity build运行PackageWeb Powershell脚本时出错

C# 从TeamCity build运行PackageWeb Powershell脚本时出错,c#,powershell,teamcity,msdeploy,C#,Powershell,Teamcity,Msdeploy,在TeamCity构建中运行Powershell脚本时,我遇到了一个令我困惑的错误。该脚本来自一个名为。该脚本用于获取MSDeploy包并将其部署到远程计算机上运行的IIS实例。脚本可以读取。我得到的错误如下: "C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:archiveDir="C:\TeamCity\buildAgent\temp\buildTmp\App Name.

在TeamCity构建中运行Powershell脚本时,我遇到了一个令我困惑的错误。该脚本来自一个名为。该脚本用于获取MSDeploy包并将其部署到远程计算机上运行的IIS实例。脚本可以读取。我得到的错误如下:

"C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync
 -source:archiveDir="C:\TeamCity\buildAgent\temp\buildTmp\App Name.csproj_zip" -
dest:auto,includeAcls='False',
ComputerName='mycomputer',Username=hurry,Password=up,AuthType='NTML' 
-disableLink:AppPoolExtension 
-disableLink:ContentExtension -disableLink:CertificateExtension 
-setParamFile:"C:\TeamCity\buildAgent\temp\buildTmp\App Name.csproj_zip\SetParameters.xml" -whatif -
skip:objectName=dirPath,absolutePath="_Deploy_" -
skip:objectName=filePath,absolutePath=web\..*\.config -skip:objectName=dirPath,absolutePath=_Package 
-skip:objectName=filePath,absolutePath=.*\.wpp\.targets$ -allowUntrusted -enableRule:DoNotDelete 

The term 'C:\TeamCity\buildAgent\temp\buildTmp\App' is not recognized as the name 
of a cmdlet, function, script file, or operable program. 
Check the spelling of the name, or if a path was included, 
verify that the path is correct and try again.
第二行肯定是罪魁祸首,而“App Name”中单词之间的空格可能是错误的,但我还没有找到正确的方法来逃避这个问题。“App Name”来自msdeploy包的zip文件名(称为“App Name.csproj_zip”)


知道为什么从TeamCity运行的Powershell在通往msdeploy的路径中不允许有空间吗?

我一直在搞Powershell+msdeploy+TeamCity,下面的函数对我来说很有用。请注意,参数{3}是指向MSDeploy的路径(其中包含空格)


可能是相关的:谢谢大卫,是的,我尝试了那里提到的大部分东西,但没有运气。
function Deploy([string]$server, [string]$remotePath, [string]$localPath) {
        $msdeploy = "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe";
        cmd.exe /C $("`"{3}`" -verb:sync -source:contentPath=`"{0}`" -dest:computerName=`"{1}`",contentPath=`"{2}`" " -f $localPath, $server, $remotePath , $msdeploy )
    }