irynabond
irynabond

Reputation: 1067

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

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.

Upvotes: 3

Views: 31257

Answers (1)

John Wu
John Wu

Reputation: 52290

  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.

Upvotes: 3

Related Questions