Best way to get the TFS URL - tfs

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.

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?

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”);

Related

TF30063: You are not authorized to access IP

I am using below code to connect my tfs where executing machine is part of domain.
But when I try the same code in different machine (not in domain, but part of work group) getting unauthorized access error.
But in the same machine (where getting error), I am able to connect TFS with same account used in code via visual studio.
var tfsServer = new TfsConfigurationServer(
new Uri(ConfigurationManager.AppSettings["TFS_URI"]),
new NetworkCredential(
ConfigurationManager.AppSettings["TFSUserName"],
ConfigurationManager.AppSettings["TFSPassword"],
ConfigurationManager.AppSettings["Domain"]));
It's going to depend on getting the network credential specified properly. I'd suggest using Fiddler to take a look at what VS is sending and what your code is sending.

TFS API isn't working from different domain

I have code on TFS API and its working fine. But when i tried that on different network domain , it got error. Error is -
"TF30063: You are not authorized to access http::///example:8181//tfs//."
But the user AC that i used to connect with TFS server in code, that is ok from VS-2012 and web URLs but not from TFS API.
is there any dependency for different domain on TFS authentication?
code -
this.collection_string = "http:://abcd:8080/tfs/" + collectionName;
this.projectCollection = new TfsTeamProjectCollection(new Uri(this.collection_string), new NetworkCredential("username", "password", "domain"));
projectCollection.EnsureAuthenticated();
this.versionControllerServer = (VersionControlServer)this.projectCollection.GetService(typeof(VersionControlServer));
this.buildServer = (IBuildServer)this.projectCollection.GetService(typeof(IBuildServer));
Console.WriteLine("Connected successfully to the server");
Try to access your TFS using IP address in your TFS URL instead of it's name. Actually, i faced the same issue earlier and it was resolved by accessing it via IP address.
Another possible solution is add a Host entry of your TFS Server in your local machine.

Delphi XE - Access https SVN server under proxy

I have a SVN Server over internet and I want to access it from my work where there's a proxy. With TortoiseSVN I just configure the Proxy Settings.
Can I Configure Proxy for Delphi XE SVN Plugin ??
All svn clients (at least all client using the official svn library) use the same settings files. So if you've set the proxy for TSVN, you've automatically set them for your plugin as well.
In order to use Version Insight with a SVN server over a proxy you have to do this:
open the file %APPDATA%\Subversion\servers in a text editor
(for Win 7 this should be c:\Users\YourUsername\AppData\Roaming\Subversion\servers)
look there for the section "global"
add there the following names, fill in your values for them and save the file
http-proxy-host
http-proxy-port
http-proxy-username
http-proxy-password
http-proxy-exceptions
At the end it should look like this
[global]
http-proxy-exceptions = *.exception.com, www.internal-site.org
http-proxy-host = defaultproxy.whatever.com
http-proxy-port = 7000
http-proxy-username = defaultusername
http-proxy-password = defaultpassword
Entering the proxy information into TSVN might work too, but I have never tested this.

TFS Absolute beginner: TF249051: No URL can be found that corresponds to the following server

This is an absolute beginner question in TFS SDK:
I am trying to connect to TFS server using the code
TeamFoundationServer teamFoundationServer =
TeamFoundationServerFactory.GetServer(X);
X is server name
I am getting an error like
TF249051: No URL can be found that corresponds to the following server name: X
Verify that the server name is correct.
However I am able to connect to the TFS server from VS2010 using Team->Connect to TFserver menu option
The TeamFoundation Server Factory is deprecated. You should use TeamFoundationProjectCollection.
And, yes, under TFS 2010, you'll need the folder.

Error deleting project in TFS

I created a "Test" project that I want to delete, using the following command:
TfsDeleteProject /server:xyz\sqlserver2008 “Test“
Getting this error:
TF30076: The server name or Uniform Resource Identifier (URI) you typed,
xyz\sqlserver2008, cannot be
resolved to a Team Foundation server.
If you type a server name, it must match the name you typed in the
Add Team Foundation Server dialog. If you type a URI, it must use
the following syntax: http[s]://:
The server instance is valid. (The installation of TFS is app tier and db are on seperate boxes) What might be going on ?
xyz is eht server name, sqlserver2008 is the db instance. For eg. I access the db using sql server management studio client app using xyz\sqlserver2008 as dbname.
Specify the full server URI including the http:// and :port. Also look for these error numbers in the MSDN.
Edit: Follow the first link, Andrew posted that's where I got my info from :)

Resources