I found number of sample of the TFS Api using the TFS Url to get the tfs server. Is there a way to use the default server configured on the machine. I don't want to put the URL in all the dll I write or in all the script.
Asked
Active
Viewed 4,564 times
2 Answers
2
You can also look at the list of locally known TFS service in the windows registry: How do I get a list of Team Foundation Server Servers available on my PC?

Community
- 1
- 1

Ewald Hofman
- 12,688
- 3
- 39
- 44
-
this is not something i thought of but would do the trick if you really don't ever want to connect to anything but a local instance – krystan honour Apr 02 '12 at 10:46
1
Obviously you need to get the machine name from somewhere I suggest if its not found in config or some other mechanism you try some of these bits of code to get the machine name and try to connect to the local machine on the default port if not specified elsewhere
string name = Environment.MachineName;
string name = System.Net.Dns.GetHostName();
string name = System.Windows.Forms.SystemInformation.ComputerName;
string name = System.Environment.GetEnvironmentVariable(“COMPUTERNAME”);

krystan honour
- 6,523
- 3
- 36
- 63