Add reference to two dlls
Microsoft.TeamFoundation.Client.dllMicrosoft.TeamFoundation.VersionControl.Client.dll
Include following assemblies,
using Microsoft.TeamFoundation.Client;using Microsoft.TeamFoundation.Framework.Client;
Authenticating TFS
// Providing URL, UserName and PasswordTfsTeamProjectCollection tpc = new TfsTeamProjectCollection(new Uri(tfsURL), new System.Net.NetworkCredential(userName,password));
// Checking Authentication
tpc.EnsureAuthenticated();
// Getting Version Control instance
VersionControlServer versionControl = tpc.GetService<VersionControlServer>();