Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to search for a specific file in the source control of TFS inside a particular selected project?

Code:

string spName = "usp_Test_Procedure.sql";
var tfsPp = new TeamProjectPicker(TeamProjectPickerMode.SingleProject, false);
tfsPp.ShowDialog();
_tfs = tfsPp.SelectedTeamProjectCollection;
if (tfsPp.SelectedProjects.Any())
{
     _selectedTeamProject = tfsPp.SelectedProjects[0];
}
string selectedProjectName = _selectedTeamProject.Name;
var tfs = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(_tfs.Uri);
var vsStore = tfs.GetService<VersionControlServer>();
var project = "project";
var branchVersion = "1.0.0";
var folders = vsStore.GetItems("$/" + selectedProjectName + "/*", RecursionType.Full);

How to search for a specific file in the source control of TFS inside a particular selected project and also selected branchversion in the dropdown menu by the user from the c# UI winforms application?

Here the file I need to search is usp_Test_Procedure.sql which is present in the following path

$/selectedProjectName/project/1.0.0/UI/Scripts/usp_Test_Procedure.sql

Actually I am getting the above path from the foolowing code:

folders.Items[29956].ServerItem

But I need to know how to search for a specific file in the source control of TFS inside a particular selected project and also selected branchversion? Thanks.

like image 240
John Stephen Avatar asked Jul 03 '14 06:07

John Stephen


People also ask

How do I search for a file in TFS?

Right-Click In the File List, right-click the file you want to check in and select Source Control > Check In (for selected files) or Source Control > Project > Check In All (for all files in the project).

How are files added to Source Control within TFS?

Ribbon Select Source Control > Add. Right-Click If you have the Content Explorer, Project Organizer, Pending Changes window pane, or File List open, right-click the file you want to add and select Source Control > Add.


2 Answers

Install TFS Power Tools, on Source Control windows click with right button on Team Project or branch, on context menu choose Find > Find by Wildcard, just search files by names, not content.

like image 53
egomesbrandao Avatar answered Sep 22 '22 07:09

egomesbrandao


If you want to search by content and name you can create a workspace and "get" that specific version locally. Then use the built in search in your OS or in Visual Studio to find what you are looking for.

like image 25
MrHinsh - Martin Hinshelwood Avatar answered Sep 26 '22 07:09

MrHinsh - Martin Hinshelwood