Table of contents

Develop and share your code in TFVC using Visual Studio

Last Updated: 8/10/2016

Team Services | TFS 2015 | Visual Studio 2015 | Visual Studio 2013

Whether your software project is large, small, or brand new, in most cases you'll be better off if you use version control as early as possible. Here, we'll show you how to get started with Team Foundation Version Control (TFVC), a centralized system. If you want to work in a distributed system, you can instead use Git with Visual Studio Team Services.

Is your code in another place? Learn how to migrate it here.

Open your team project in Visual Studio

  1. Before you start, if you haven't already:

  2. Go to your team project's page (http://{youraccount}.visualstudio.com/DefaultCollection/{yourteamproject}) and then open Visual Studio to connect to your team project.

    On your team project overview page, click Open in Visual Studio

  3. Sign in to Visual Studio Team Services from Visual Studio.

Configure your workspace

  1. In Visual Studio, configure your workspace.

    On Team Explorer home page, click Configure Workspace

    I don't see the Configure Workspace link. What do I do next?

  2. Confirm your workspace path, map your workspace, and get the source.

    On Team Explorer home page, click Map and get

  3. Now you can check in source, queue builds, and manage work.

    Visual Studio is now connected to your team project

Create a new app

If you already have an app that you want to add to version control, skip down to Add an existing app.

New solution from team explorer

Now that you've added your app, you can skip down to snapshot your code.

Add an existing app

Move and open the solution

  1. Close the solution.

  2. Open the workspace folder that you created when you configured your workspace.

    Open the workspace folder from source control explorer

  3. Move the code you want to upload to the workspace folder.

    Move your source code to your workspace folder

  4. Open your solution in Visual Studio.

    Open your solution in Visual Studio

Add the solution to Visual Studio Team Services

  1. Open the solution explorer (Keyboard: Ctrl + Alt + L).

  2. Add your solution to version control.

    Add the solution to Visual Studio Team Services

  3. Check in the solution.

    Check in your solution

  4. Add a comment and check in.

    Add a comment and check in pending changes

  5. Open the source control explorer.

    Open the source control explorer

    Your solution is now in TFS.

    Your solution in the source control explorer

Your whole team can work on the code now. All your changes are tracked in version control.

Snapshot (check in) your code

  1. When you edit code in Visual Studio, the changed file is automatically checked out. For example, Site.css is checked out after the border color has been changed to #ddd.

    Checked out file in the team explorer

  2. Compare the modified file with the latest version in source control.

    Compare in the solution explorer's context menu

    You can see the difference between the two versions.

    Compare window

  3. Check in the changes.

    Check in from the context menu in the solution explorer

    You can also check in from the code window, or the team explorer.

  4. If you're working on a task or fixing a bug that's tracked as a work item, add that work item to your pending changes. Source control will resolve the bug or close the task, and it'll link the changeset to the work item.

    Related work items in pending changes

  5. Add a comment and check in.

    Source control explorer, source file context menu, check in

  6. Open the source control explorer.

    Source control explorer in the team explorer home page

  7. View the history of the file you changed.

    Source control explorer, source file context menu, view history

    All the changesets that include this file are listed.

    History window

Try this next

Get your code reviewed

Q&A

Q: My code is somewhere else. Can I migrate it to my TFVC project on Visual Studio Team Services?

A: Yes:

Q: Why is my sign-in page different than when I sign in to Visual Studio?

A: Your sign-in page depends on whether you used a Microsoft account or work account with Team Services. So, sign in with the username and password that you used with Team Services.

Q: Why doesn't Visual Studio launch when I click "Open in Visual Studio" on my team project page?

A: This link requires Visual Studio 2013 or later. It doesn't launch earlier versions of Visual Studio.

To connect earlier versions, see Which versions of Visual Studio can I use with Visual Studio Team Services?

Q: Can I use earlier versions of Visual Studio to connect to Visual Studio Team Services?

A: Yes, you can use Visual Studio 2013 or 2012. You can also use Visual Studio 2010, but you'll need to install Service Pack 1 and KB2662296 first. Or, you can use Visual Studio 2008 SP1, with this GDR update. Launch Visual Studio, then connect to Visual Studio Team Services using your account URL, and select your team project.

A: You might already have a workspace on your computer. To see your workspace, open Source Control Explorer. Or change your workspace. Find out how to manage files under source control or manage workspaces.

In Team Explorer, click Source Control Explorer or Manage Workspaces

© 2016 Microsoft