TFS API: GetLocalWorkspaceInfo always returns null

前端 未结 8 1304
無奈伤痛
無奈伤痛 2020-12-24 06:46

On one of my machines, I get a return value of null from any GetLocalWorkspaceInfo call. I have isolated to problem to where it even fails for this simple progr

8条回答
  •  太阳男子
    2020-12-24 07:11

    In my case, this issue occurred because of VersionControl.config file put under TFS cache (C:\Users\DeepakR\AppData\Local\Microsoft\Team Foundation\5.0\Cache\Volatile\0cb76a25-2556-4bd6-adaa-5e755ac07355_http)folder goes for a toss i.e. the configured workspace information weren't available as expected.

    So, It basically needs a refresh of VersionControl.config file. Auto Refersh happens when Visual Studio gets loaded again i.e. it pulls the configured workspace information from Server and updates the config file or even if we execute tf command utility (tf.exe workspaces /collection:TFSURL)

    Microsoft.TeamFoundation.VersionControl.Client's(v12.0.0.0) Workstation class has a function EnsureUpdateWorkspaceInfoCache which will do the same trick

    VersionControlServer vcs = (VersionControlServer)tpc.GetService(typeof(VersionControlServer)); Workstation.Current.EnsureUpdateWorkspaceInfoCache(vcs, Environment.UserName);

    https://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.versioncontrol.client.workstation.ensureupdateworkspaceinfocache(v=vs.120).aspx

    Hope the suggestion helps to resolve the issue.

提交回复
热议问题