从 TFS 服务器工作区中排除文件 [英] Excluding Files from TFS Server Workspace

查看:29
本文介绍了从 TFS 服务器工作区中排除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们刚刚在公司中实施了 TFS,我不小心包含了 bin 和 obj 文件夹.我想排除它们.我在谷歌上搜索,发现基本上有两种方法可以做到这一点:

1)

另见:

  • We just implemented TFS in our company and I accidentaly included the bin and obj folders. I would like to exclude them. I searched on Google and found basically 2 ways to accomplish this:

    1) https://msdn.microsoft.com/en-us/library/66tw9ezk(v=vs.90).aspx

    In Visual Studio, open Solution Explorer and select the file to exclude. On the File menu, click Source Control, then click Exclude from Source Control. When you are ready to place the file under source control, you can access the File menu and click Source Control, then uncheck Exclude from Source Control.

    In my File>Source Control, I don't see exclude from source control there or under advanced.

    2) How do I permanently exclude the bin and obj folders from TFS 2012 checkin?

    I tried adding a .tfignore and I couldn't find the 'ignore by extension', 'ignore file', etc. in teh Promote Candidate Changes dialog box. As far as I understand this is only applies to a local workspace and not a server workspace.

    We set up the solution to checkout a file whenever it's altered, so when someone builds the project he acquires an exclusive lock on the dlls and then nobody else is able to compile.

    解决方案

    After the steps Mike describes, you can go further and define an ignore rule. Undo the pending changes to the file you want to exclude and then click the "detected: 123" link that shows under "Excluded changes".

    This open up a new window in which you can ignore these changes indefinitely. It does this by creating a .tfignore file and adding that to source control. The alternative to the UI is t create this file manually and checking it in. This should prevent Team Explorer from showing files that match the patterns in the ignore file.

    Make sure that these files are deleted from source control, if they were checked in accidentally, you can destroy them to make sure they are truly gone. You'll need to do this from the commandline using tf destroy

    The call to Destroy won't delete your local files when you use the remote itemspec to destroy them:

    C:\>tf destroy /collection:http:
    //jessehouwing:8080/tfs/DefaultCollection $/Scrum/test.txt.txt /noprompt
    Destroyed: $/Scrum/test.txt.txt
    
    C:\Program Files (x86)\Microsoft Visual Studio 14.0>dir "c:\Workspaces\Local\Scrum"
     Volume in drive C has no label.
     Volume Serial Number is 008A-AC5B
    
     Directory of c:\users\jhouw\Source\Workspaces\Local\Scrum
    
    12-08-2015  20:12    <DIR>          .
    12-08-2015  20:12    <DIR>          ..
    12-08-2015  20:12                 0 test.txt.txt
                   1 File(s)              0 bytes
                   2 Dir(s)  297.229.512.704 bytes free
    

    After performing a tf get /collection:http: //jessehouwing:8080/tfs/DefaultCollection $/Scrum /recursive it will indeed be deleted. This should not be an issue if the files in question are regenerated during the next build.

    See also:

    If you're using a server workspace, the only way I can think of is to set a Forbidden Path checkin policy for your source control repo. It's a part of the Team Foundation Server Power Tools; you'd need to install the version of the power tools that matches your Visual Studio version on all developers' machines.

    Note: these use Regular Expressions, so you'll need to adjust your pattern to match ;).

    这篇关于从 TFS 服务器工作区中排除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆