同樣的問題(可能是因爲我有多個工作區) 所以我用下面的代碼解決了它:
$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-tfschilditem「$/myfilepath」之間的區別是什麼? update-tfsworkspace'?沒有使用過TFS,只是搜索了一下,看到每個人都將他們的輸入引入'update-tfsworkspace'。 –
Update-TfsWorkspace對我進行工作區更新工作得很好。 –