Many users in the process of using TFS complain about a problem and cannot find files in the code base of TFS! Although all of TFS's data is stored in the database (SQL Server), you cannot query the database directly through the functionality of the full-text search because of the particularity of the code file store. The latest version of TFS Update 4 and TFS Online is not able to find code-related search functionality on the interface.
However, through the research, discover the TFS code base in the query function, there are the following methods:
1. Using the command-line tool of TFS code TF.exe querying the code library for files
The command-line tool for TFS code TF.exe Almost everything that is done under the UI interface. By using the "dir" command, you can query a file by file name or regular expression in the remote code base.
The following table is the Help information for TF dir:
C:\USERS\DANZHANG>TF dir/? Microsoft (R) tf-team Foundation version Control Tool, version 12.0.30501.0 Copyright (c) Microsoft Corporation. All rights reserved. Displays all or a part of the contents of a Team Foundation version control Server. tf dir itemspec [/version:versionspec] [/recursive] [/folders] [/deleted] [/login:username,[password]] [/collection:teamprojectcollectionurl] Versionspec: Date/time D "any. Net framework-supported format" or any of the date formats of the Local machine Changeset number cnnnnnn Label Llabelname Latest version T Workspace Wworkspacename;workspaceowner |
Here is an example of how to use this dir command. For example, "to query all Word files in the $/directory of the CODEBASE and output the query results to SearchResult.txt", you can use the following command:
C:\DATADANZHANG>TF dir "$/*.doc"/recursive/collection:http://tfsserver:8080/tfs/defaultcollection > SearchResult.txt
Figure 1-Query results
2. Use TFS plug-ins to query files or code in the code base
The above mentioned the use of TFS own tools to implement file queries, we can also use third-party plug-ins to query files, and even code. Here is a description of the famous tool TFS Administrators Toolkit for VS 2013. You can download the installation file via the following link:
Https://visualstudiogallery.msdn.microsoft.com/33713c5d-31a3-44b3-ae94-3c413e6b21c7
In Team Explorer with the TFSAdmin plugin installed, we will find that right-clicking in the code base will add a menu "Tfsadmintoolkit–find in Files" (e.g.)
Figure 2-Query Menu
Figure 3-Query window
You can enter a filename, a regular expression query file in this window, or you can enter a code in the window to find the file containing the source code characters.
Http://www.cnblogs.com/danzhang Zhang Hongjun
Find files or code in team Foundation server