How can I find the url of Team Foundation Server in Visual Studio?

25,473
  1. Click Team menu
  2. Select "Connect to Team Foundation Server..."
  3. In Team Explorer window, click "Select Team Projects..."
  4. On the dialog, click the "Servers..." button.
Share:
25,473
irynabond
Author by

irynabond

Updated on July 09, 2022

Comments

  • irynabond
    irynabond almost 2 years

    My project in VS is connected to VS Portal. I'm going to add work items programmatically using C#. Here is the snipped of code:

    using Microsoft.TeamFoundation.Client;
    using Microsoft.TeamFoundation.WorkItemTracking.Client;
    
    
        namespace CSTFSWorkItemObjectModel
        {
            class Program
            {
                static void Main(string[] args)
                {
    
                    var tfsUrl = ConfigurationManager.AppSettings["TfsUrl"];
                    var tfs = TeamFoundationServerFactory.GetServer(tfsUrl);
    
                    // WorkItemStore instance.
                    var wis = (WorkItemStore)tfs.GetService(typeof(WorkItemStore));
    
                    // Read project name form the application configuration file
                    var projectName = ConfigurationManager.AppSettings["TeamProject"];
    
    
                    EnsureWITImported(wis, projectName);
    
                    var project = wis.Projects[projectName];
    
                    var id = CreateWorkItem(project);
                    var wi = GetWorkItem(wis, id);
                    EditWorkItem(wi);
    
                    QueryWorkItems(wis, projectName);
    
                    Guid queryGuid = EnsureWIQueryCreated(wis, project);
                    QueryWorkItemAsynchronously(wis, queryGuid, project);
                }
             }
          }
    

    What is my TfsUrl? I have app.config file where I specify TfsUrl and TeamProject credentials. I tried to use TfsUrl as 'http://account.visualstudio.com but it didn't work. When I go to Team menu I see 'Disconnect from Team Foundation Server", so it means I'm connected now. Please help me.

  • irynabond
    irynabond over 7 years
    Hi. Thanks for your answer. I don't have button 'Connect to Team Foundation Server'. I have the button 'Disconnect rom TFS'. When I tried to disconnect first, I don't see 'Connect to TFS', then I have only 'Manage connections' button.
  • Paul Swetz
    Paul Swetz over 7 years
    Hit manage connections -> connect to Team project for the window. I feel like this has recently changed.
  • Paul Swetz
    Paul Swetz over 7 years
    Also if you just hit your Home button in the team explorer you should see the url for the team project you are on listed at the top under Team Foundation Server, just strip out the [Team Project Collection]/[Team Project]/xxxxx stuff