VSTS删除本地工作区文件

记得参与上一个项目以后,离开team的时候,工作区没有删除.今天在公司的TFS上新建了一个团队项目,准备将源代码上传.然而在创建工作区的时候遇到错误提示:"路径...已经定义到工作区".到msdn上查了查,只有这么一句提示"所选的本地文件夹先前不能与其他工作区关联。"于是晕.

在与TFS联机的情况下,可以在Team Explorer图形界面中删除工作区,也可以在Visual Studio命令提示符下输入"tf workspace /delete yourworkspace;yourworkspaceowner"进行删除.不过,现在我已经无法连接以前的TFS,于是,将原来的路径改名,再添加工作区,不会再提示冲突.但我知道原来的工作区本地缓存并没有被去掉.于是继续查找解决方案.最后,发现如下命令:"tf workspaces /remove:yourworkspace;yourworkspaceowner".搞定.

VSTS也用了一年时间了,但大部分的时候只是签入签出.今天遇到的问题,费力在网上找了半天答案,最终结果还是指向了msdn.

google上也能查找到比较详细的解释:

You can use the command "tf workspaces /remove:*" to clear out all of the cached workspaces (it only affects the cache file). You can specify /s:http://oldserver:8080/ to just clear out the workspaces that were on the old server. The MSDN doc for the workspaces command are at http://msdn2.microsoft.com/en-us/library/54dkh0y3.aspx.

The reason that you hit this is due to switching servers. Every server has a unique identifier, which is a GUID. Each local path can only be mapped in a single workspace. You originally had a workspace on the first server that used the local path you wanted to use with the new server. Let's say that's c:\projects. When you create the new workspace on the new server (GUID2) that you also want to map to c:\projects, the client sees that the old server (GUID1) is already using that local path. Since the IDs for the servers do not match, the client complains that c:\projects is already mapped to the old workspace on the old server.

The solution is to clear the cache file, as described above. The problem will not occur if you upgrade the same server (i.e., you don't create a new server).

posted @ 2008-12-22 16:26  Bryan Wong  阅读(2374)  评论(1编辑  收藏  举报