Develop and share your code in Team Foundation Version Control using Visual Studio

Azure DevOps Services | Azure DevOps Server 2020 | Azure DevOps Server 2019 | TFS 2018

Visual Studio 2022 | Visual Studio 2019 | Visual Studio 2017 | 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 Azure Repos.

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

Open your project in Visual Studio

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

  2. Go to your project's page (https://dev.azure.com/{your organization}/{your team project}) and then open Visual Studio to connect to your project.

    On your project overview page, click Open in Visual Studio

  3. Sign in to Azure DevOps Services from Visual Studio.

Configure your workspace

  1. In Visual Studio, configure your workspace.

    Screenshot shows the Team Explorer Home page, with the Configure Workspace link.

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

  2. Confirm your workspace path. Select Map & Get to map your workspace and get the source.

    Screenshot shows the Team Explorer Home page, with Map and get highlighted.

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

    Screenshot shows a success message that verifies that Visual Studio is now connected to your project.

    Note

    TFVC is not supported when workspaces are placed on network drives or UNC paths.

Create a new app

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

In Team Explorer, select New.

Screenshot shows the Team Explorer Home page with New highlighted under Solutions.

Now that you've added your app, you can skip 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.

    Screenshot shows Source Control Explorer with your workspace folder selected.

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

    Screenshot shows moving your source code to your workspace folder.

  4. Open your solution in Visual Studio.

    Screenshot shows Team Explorer Home page, where you can open your solution in Visual Studio.

Add the solution to Azure Repos

  1. Press Ctrl+Alt+L to open Solution Explorer.

  2. Add your solution to version control.

    Screenshot shows a context menu with Add the solution to Source Control selected.

  3. Check in the solution.

    Screenshot shows a context menu with Check In selected.

  4. Add a comment and check in.

    Screenshot shows a Pending Changes pane with a comment and a Check In button.

  5. Open the source control explorer.

    Screenshot shows the Team Explorer Home page with Source Control Explorer selected.

    Your solution is now in TFS.

    Screenshot shows the result, where 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.

    Screenshot shows Solutions Explorer with the file Site dot c s s checked out.

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

    Screenshot shows the Compare option in the Solution Explorer context menu.

    You can see the difference between the two versions.

    Screenshot shows the compare window, with two versions of the file side by side.

  3. Check in the changes.

    Screenshot shows the Check in option in the Solution Explorer context menu.

    You can also check in from the code window or 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 resolves the bug or closes the task. It links the changeset to the work item.

    Screenshot shows Related Work Items in pending changes.

  5. Add a comment and check in.

    Screenshot shows where you can add a comment and check in the files.

  6. Select Source Control Explorer.

    Screenshot shows Source Control Explorer in the Team Explorer Home page.

  7. View the history of the file you changed.

    Screenshot shows View History in the source file context menu.

    All the changesets that include this file are listed.

    Screenshot shows the history window with changesets.

Troubleshooting

  • I don't see the Configure Workspace link shown in the steps above. What do I do next?

    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.

    Screenshot shows Team Explorer, where you can select Source Control Explorer or Manage Workspaces.

Next steps