First, you need to log on to TFs.
Previous articles used domainprojectpicker
In the latest vs, teamprojectpicker is used.
First, you can write a button in the winform program, and then write the following code:
Uri tfsuri = new uri ("Your TFs"); tfsteamprojectcollection Server = new tfsteamprojectcollection (tfsuri); teamprojectpicker TPP = new teamprojectpicker (teamprojectpickermode. singleproject, false); TPP. showdialog (); If (TPP. selectedteamprojectcollection! = NULL) {Server = TPP. selectedteamprojectcollection;} else {MessageBox. Show ("select project"); return ;}
In this way, the selected TFs content is stored in the server.
Here, teamprojectpickermode has three enumerations, which correspond to the following menus respectively. You can select one based on the desired effect.
public enum TeamProjectPickerMode{NoProject = 0,SingleProject = 1,MultiProject = 2,}
Noproject
Singleproject
Multiproject
After the selection, you can put it in projectinfo.
ProjectInfo[] pi;pi = tpp.SelectedProjects;string ProjectURL = pi[0].Name;
TFS secondary development-baseline File Manager (2)-TFs Logon