簡體   English   中英

從TeamCity構建中運行PackageWeb Powershell腳本時出錯

[英]Error running PackageWeb Powershell script from TeamCity build

在TeamCity構建中運行Powershell腳本時,我遇到了一個困惑的錯誤。 該腳本來自一個名為PackageWeb的Nuget包。 該腳本旨在獲取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.

第二行必須是罪魁禍首,“應用程序名稱”中單詞之間的空格可能有誤,但我還沒有找到適當的方法來避免這種情況。 “應用程序名稱”是從msdeploy軟件包的zip文件名中獲得的(稱為“應用程序名稱.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 )
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM