TFS: Search for a file by name in source control

Visual Studio-2010TfsSource Control-Explorer

Visual Studio-2010 Problem Overview


I can't find a file in our source control of the TFS because it's simply a big mess. So I want to know if there is a way to search for files by their name?

I've heard of the Power Tool for TFS which enables search functionality but the problem is that it has to be installed and our sysadmin is currently not available. So does maybe a simple plugin exist?

Visual Studio-2010 Solutions


Solution 1 - Visual Studio-2010

If you are using Visual Studio 2010

  • Right click on your collection or team project
  • Select 'Find in source control'
  • Then select 'status' or 'wildcard'
  • You can search for your files there

The following will list all the items in your repository without checking them out

tf Dir command

tf dir /recursive $/

you can pass in the item you are searching for also e.g.

tf dir /recursive $/*.cs

gets all the .cs files in all team projects

Note: depending on how big your source is, this could take sometime.

Solution 2 - Visual Studio-2010

If you have created a workspace on your local, then you can search a file in your local to get the path.

Solution 3 - Visual Studio-2010

If you're using Azure DevOps you can open the Azure Repos section in Azure DevOps for your project. There is a search input on this screen that allows you to search your code. You can find out more in Microsoft's documentation: https://docs.microsoft.com/en-us/azure/devops/project/search/code-search?view=azure-devops

Solution 4 - Visual Studio-2010

Combining WebPlanet's answer and this https://devatheart.com/2010/10/24/searching-for-a-file-in-team-foundation-server/

I got the following to work when searching for a .rdl file on my TFS server.

"C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\TF.exe" dir "$/*.rdl" /recursive /server:http://yourTFSserver
  • In my case tfs.exe was in the VS 2017 location.
  • http://yourTFSserver should be the path to the TFS server's web interface (including any port and path)

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionManuel ZelenkaView Question on Stackoverflow
Solution 1 - Visual Studio-2010Webplanet TFS ConsultingView Answer on Stackoverflow
Solution 2 - Visual Studio-2010kranyView Answer on Stackoverflow
Solution 3 - Visual Studio-2010CalumView Answer on Stackoverflow
Solution 4 - Visual Studio-2010MatthewView Answer on Stackoverflow