Search code examples
c#.nettfsvsx

How do you get the default TFS Server from Team Explorer?


A call like this requires the server name or url:

TeamFoundationServerFactory.GetServer("mytfsserver");

Likewise, I can use the following to get a list of available servers or server names:

TeamFoundationServer[] servers = RegisteredServers.GetServers();
string[] serverNames = RegisteredServers.GetServerNames();

But how do I get the default server that Team Explorer uses to connect?

Alternatively, if I could get the current workspace I think I could use that to get the correct TeamFoundationServer to connect with. However, I want to be able to do this before a solution is loaded which means I do not have a file to use for querying what workspace it belongs in.


Solution

  • See the following: http://blogs.msdn.com/hippietim/archive/2006/03/29/563988.aspx