Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/tfs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Powershell 更新TFSWorkspace不起作用_Powershell_Tfs - Fatal编程技术网

Powershell 更新TFSWorkspace不起作用

Powershell 更新TFSWorkspace不起作用,powershell,tfs,Powershell,Tfs,为什么 Update-TfsWorkspace [[-Item] <QualifiedItemSpec[]>] [-All] [-Force] [-Overwrite] [-Recurse] [-Version <String>] 使用Win8 以下是我正在使用的确切命令: Update-TfsWorkspace -Item "$/myfilepaht" this does NOT WORK tf get itemspec "$/myfilepaht" #this W

为什么

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

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

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

tf get itemspec "$/myfilepaht" #this WORKS
我也有同样的问题(可能是因为我有多个工作区) 所以我用下面的代码解决了这个问题:

$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)

您是否收到错误或文件没有更新?只是好奇,使用
Update-TfsWorkspace-Item“$/myfilepaht”
和使用类似
Get-tfschilitem“$/myfilepath”| Update-TfsWorkspace
的内容有什么区别?没有使用TFS,只是在谷歌上看到每个人都将他们的输入输入到
update tfsworkspace
update tfsworkspace
对我进行工作区更新非常有效。我正在尝试获取一个文件。它在powershell cmdlet中引发的错误是“找不到工作区”的效果,我在这里使用您的代码,这非常有效,但是,我找不到执行此代码并让它通过powershell命令提示符更新其工作的方法。。。换句话说,它只是在幕后默默地工作。。。
$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)