我有一個powershell腳本,我試圖通過teamcity運行。該腳本存儲在代碼構建自的git倉庫中。我已經設置的TeamCity運行腳本的腳本文件Teamcity似乎損壞了Powershell腳本
如果我運行從構建一個PowerShell命令行腳本斷絕它運行正常,如果我從TeamCity的運行相同的腳本,我得到這樣的錯誤
[16:04:25][Step 3/3] Get-Date : Cannot bind parameter 'Date'. Cannot convert value "â€「f" to type
[16:04:25][Step 3/3] "System.DateTime". Error: "The string was not recognized as a valid DateTime.
[16:04:25][Step 3/3] There is an unknown word starting at index 0."
[16:04:25][Step 3/3] At line:1 char:26
[16:04:25][Step 3/3] + Write-Output "$(Get-Date â€「f $timeStampFormat) - Upgrading Deployment: In
[16:04:25][Step 3/3] progr ...
[16:04:25][Step 3/3] + ~~~~
[16:04:25][Step 3/3] + CategoryInfo : InvalidArgument: (:) [Get-Date], ParameterBindin
[16:04:25][Step 3/3] gException
[16:04:25][Step 3/3] + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerSh
[16:04:25][Step 3/3] ell.Commands.GetDateCommand
[16:04:25][Step 3/3]
爲什麼會發生這種情況?
很難指出問題,但有可能Powershell腳本編碼在進入git repo時發生了改變,從而改變了腳本中的一些字符。你可以嘗試在執行之前輸出導致錯誤的行並查看這些值是什麼? – 2013-05-01 20:24:13
嘗試運行代理上位置的powershell腳本,並檢查編碼,如Muz說的,Git和文件編碼。 – 2013-05-02 08:46:24