【发布时间】:2016-04-19 04:56:51
【问题描述】:
我正在尝试以编程方式重试之前完成的 TFS 构建。 (就像您可以通过“操作,重试构建”在 VS 中执行的操作一样。)
下面的示例 PS 代码连接到 TSF,通过其 ID 获取先前构建的构建队列,并尝试设置其重试状态并保存。保存失败,说构建状态需要“完成”。查询状态显示“已完成”。
. ".\loadTfsAssemlies.ps1"
$tfsURL = "http://myServer:8080/tfs/myCollection"
$tpc = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($tfsURL)
$bs = $tpc.GetService([Microsoft.TeamFoundation.Build.Client.IBuildServer])
$qb = $bs.getqueuedbuild(258498,"All")
$qb.retry()
$qb.save()
Exception calling "Save" with "0" argument(s): "Queued build 258498 on build controller blah blah can only be retried if the status is Completed. The status was Completed."
At line:1 char:1
+ $qb.save()
+ ~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : QueuedBuildUpdateException
$qb.status
Completed
有什么想法我在这里做错了吗?或者可能知道重试先前构建的更好方法?
【问题讨论】:
-
你有没有克服这个问题?我现在才遇到。太奇怪了,
"can only be retried if the status is Completed. The status was Completed."
标签: powershell tfs build