Tfs Powershell 工具是否适用于远程工作区?

Do Tfs Powershell tools work wtih remote workspaces?

美好的一天。 我在远程计算机上创建了一个 tfs-workspace,并在 Visual Studio 中使用它。一切正常,签入和签出工作正常。 今天我决定自动执行一些任务,但是 Powershell 工具在使用这个工作区时会抛出各种错误。

我检查了脚本在本地文件夹中的工作 - 一切正常。 我尝试使用 UNC 路径的变体 (FileSystem::myPath)、Resolve-Path、Get-ChildItem、Get-TfsChildItem,但它们都不起作用。 tf checkout 甚至无法确定工作区。

是否有任何变体可以在 PowerShell 中使用远程计算机上的工作区?

P.S。第 13 版的 TFS、VS、TFPT。 P.P.S。我不能使用 "net use" 或者它是模拟的。

P.P.P.S 命令和结果:

Microsoft.PowerShell.Core\FileSystem::\srv-tfsmain\D$\NetWorkspace\MyUser\Test> tf checkout 15
tf : Unable to determine the workspace. You may be able to correct this by running 'tf workspaces /collection:TeamProjectCollectionUrl'.


Microsoft.PowerShell.Core\FileSystem::\srv-tfsmain\D$\NetWorkspace\MyUser\Test> Add-TfsPendingChange -edit 15
Add-TfsPendingChange : The filename, directory name, or volume label syntax is incorrect. $path


Microsoft.PowerShell.Core\FileSystem::\srv-tfsmain\D$\NetWorkspace\MyUser\Test> Add-TfsPendingChange -edit (Resolve-Path 15)
Add-TfsPendingChange : Cannot bind parameter 'Item'. Cannot convert the "Microsoft.PowerShell.Core\FileSystem::\srv-tfsmain\D$\NetWorkspace\MyUser\Test" value of type "System.Management.Automation.PathInfo" to type "Microsoft.TeamFoundation.PowerTools.PowerShell.QualifiedItemSpec".

更新 1. 错误路径不正确:工作区映射到 \srv-tfsmain\NetWorkspace\MyUser\Test,我在 \srv-tfsmain\D$\NetWorkspace\MyUser\Test 中使用了命令。更正路径后,tf 工作正常,但

Add-TfsPendingChange -edit

不适用于任何形式的 UNC 路径。

这样不行。 TFS 的工作空间概念意味着您为命令提供您在工作空间中定义的相同路径。因此,如果您在 PC01 上定义了将 $/MyProject 映射到 C:\wrk01 的工作区 WRK01,则必须 运行使用 C:\wrk01 在本地命令; \PC01\c$\work01 否则不行。

使用 Powershell,您可以使用远程会话 运行 本地的 cmdlet(但它们必须安装在目标机器上),参见 Enter-PSSession 开始。