简体   繁体   English

Tfs Powershell工具可以在远程工作空间中工作吗?

[英]Do Tfs Powershell tools work wtih remote workspaces?

Good day. 美好的一天。 I created a tfs-workspace on a remote computer, and worked with it in Visual Studio. 我在远程计算机上创建了一个tfs-workspace,并在Visual Studio中使用它。 All fine, check-ins and check-outs work correctly. 所有罚款,入住和退房均能正常工作。 Today I decided to automate some tasks, but Powershell tools throws various error during working with this workspace. 今天,我决定自动化一些任务,但是Powershell工具在使用该工作区时会引发各种错误。

I checked scripts' work on local folder - all fine. 我检查了脚本在本地文件夹上的工作-一切正常。 I've tried to use variations of UNC paths (FileSystem::myPath), Resolve-Path, Get-ChildItem, Get-TfsChildItem, but all of it doesn,t work. 我尝试使用UNC路径(FileSystem :: myPath),Resolve-Path,Get-ChildItem,Get-TfsChildItem的变体,但是所有这些都行不通。 tf checkout even can't determine the workspace. tf checkout甚至无法确定工作空间。

Are there any variants to work with a workspace on remote computer in PowerShell? 在PowerShell中可以使用任何变体与远程计算机上的工作区一起使用吗?

PS TFS, VS, TFPT of 13th version. PS TFS,VS,TFPT的第13版。 PPS I can't use "net use" or it's analogue. PPS我不能使用“网络使用”或类似的方式。

PPPS Commands and results: PPPS命令和结果:

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\15" value of type "System.Management.Automation.PathInfo" to type "Microsoft.TeamFoundation.PowerTools.PowerShell.QualifiedItemSpec".

Upd 1. The error was in the incorrect path: Workspace was mapped to \\srv-tfsmain\\NetWorkspace\\MyUser\\Test, and i used command in \\srv-tfsmain\\D$\\NetWorkspace\\MyUser\\Test. 更新1.错误位于错误的路径中:工作区已映射到\\ srv-tfsmain \\ NetWorkspace \\ MyUser \\ Test,并且我在\\ srv-tfsmain \\ D $ \\ NetWorkspace \\ MyUser \\ Test中使用了命令。 After correcting path, tf works fine, but 校正路径后,tf可以正常工作,但是

Add-TfsPendingChange -edit

doesn't work with any form of UNC path. 不适用于任何形式的UNC路径。

It cannot work that way. 它不能那样工作。 The TFS concept of workspace implies that you give command the same path you defined in the workspace. TFS工作空间的概念意味着您要给命令提供与工作空间中定义的相同的路径。 So if on PC01 you defined workspace WRK01 that maps $/MyProject to C:\\wrk01 , you must run the command locally with C:\\wrk01 ; 因此,如果在PC01上定义了将$/MyProject映射到C:\\wrk01工作空间WRK01 ,则必须使用C:\\wrk01在本地运行命令; \\\\PC01\\c$\\work01 or else won't work. \\\\PC01\\c$\\work01否则将不起作用。

Using Powershell, you can use a remote session to run the cmdlets locally (but they must be installed on the target machine), see Enter-PSSession to start. 使用Powershell,您可以使用远程会话在本地运行cmdlet(但必须将它们安装在目标计算机上),请参阅Enter-PSSession以启动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM