0

为什么

Update-TfsWorkspace [[-Item] <QualifiedItemSpec[]>] [-All] [-Force] [-Overwrite] [-Recurse] [-Version <String>]

不行?等效的 tf.exe 在完全相同的文件夹中工作得很好:

tf get itemspec [/version:versionspec] [/all] [/overwrite] [/force] [/preview] [/recursive] [/remap] [/noprompt]

使用 Win 8。

以下是我正在使用的确切命令:

Update-TfsWorkspace -Item "$/myfilepaht" this does NOT WORK

tf get itemspec "$/myfilepaht" #this WORKS
4

1 回答 1

0

I had the same problem (probably because I have multiple workspaces) So I solved it with the following code:

$tfsCredential = Get-Credential;
$tfsServer = Get-TfsServer -Name "https://tfs.tools4ever.com:443/tfs/t4edevnet2010" -Credential $tfsCredential;;
$tfsws = Get-TfsWorkspace -Server $tfsServer -Computer $hostname -Owner $tfsCredential.UserName;
$tfsPath = $tfsws.GetServerItemForLocalItem($filename);
$prop = Get-TfsItemProperty -Item $tfsPath -Server $tfsServer -Workspace $script:tfsws;
$tfsws.Get(@($tfsPath), [Microsoft.TeamFoundation.VersionControl.Client.VersionSpec]::Parse($prop.VersionLatest,     $script:tfsws.OwnerName)[0], [Microsoft.TeamFoundation.VersionControl.Client.RecursionType]::Full, [Microsoft.TeamFoundation.VersionControl.Client.GetOptions]::None)
于 2013-05-06T14:14:19.000 回答