【发布时间】:2019-07-15 18:15:09
【问题描述】:
我正在尝试使用 PowerShell 构建一个 tfs 工作站,但我陷入了困境。
在我的代码中是行
$teamProjectCollection = [Microsoft.TeamFoundationClient.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($tfsServer)
$ws = $teamProjectCollection.GetService([type] "Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore")
我从this answer 那里得到了关于我最近提出的另一个问题的这些信息。答案解决了我当时遇到的问题,但不幸的是,第二行在尝试将字符串转换为 Type 时出现异常。具体来说,我得到的错误是:
无法将“System.String”类型的“Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore”值转换为“System.Type”类型。
我知道我正在使用的 GetService 函数需要一个 System.Type 参数。我还没有找到严格通过 PowerShell 将 System.String 对象转换为 System.Type 对象的方法。
那么,我该如何解决这个问题或解决这个问题?
【问题讨论】:
-
[Microsoft.TeamFoundation.WorkItemTracking.Client.WorkItemStore] | Get-Member有什么回报吗? -
它没有。它得到一个 TypeNotFound 异常。
-
您是否已将
Microsoft.TeamFoundation.WorkItemTracking.Client.dll程序集添加到该 PowerShell 会话中? -
这就是问题所在。您想将其发布为答案吗?
-
我贴出来了。谢谢。
标签: powershell tfsbuild