简体   繁体   中英

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. 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.

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. tf checkout even can't determine the workspace.

Are there any variants to work with a workspace on remote computer in PowerShell?

PS TFS, VS, TFPT of 13th version. PPS I can't use "net use" or it's analogue.

PPPS Commands and results:

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. After correcting path, tf works fine, but

Add-TfsPendingChange -edit

doesn't work with any form of UNC path.

It cannot work that way. The TFS concept of workspace implies that you give command the same path you defined in the workspace. So if on PC01 you defined workspace WRK01 that maps $/MyProject to C:\\wrk01 , you must run the command locally with C:\\wrk01 ; \\\\PC01\\c$\\work01 or else won't work.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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