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)