Set up Team Foundation Version Control on your dev machine

To set up Team Foundation Version Control (TFVC) on your dev machine, you just need to create a workspace and then add your code.

Before you start

Create a workspace and get the code

From Visual Studio, go to the Team Explorer Connect page (Keyboard: Ctrl + 0, C) and then connect to the team project.

Connecting to a TFVC team project

(If the team project you want to open is not listed, choose Select Team Projects and then connect to the team project.)

Map the team project to a folder on your dev machine.

Visual Studio prompts you to map the team project

Map the workspace and get your code.

Configuring your workspace

Work in a “Main” parent folder

Do you want to prepare for when your team grows large enough to need branches to manage your work? Put all your code in a parent called Main (for example: $/MyTeamProject/Main/).

  1. Go to the Team Explorer Home page (Keyboard: Ctrl + 0, H), and then open Source Control Explorer.

  2. In Source Control Explorer, select your team project in the left pane.

  3. On the menu bar choose File, Source Control, New Folder.

    Create the "Main" folder at the team project root

    Name the folder.

    Open the context menu of the Main folder and choose Check in.

  4. Check in the new folder.

    Check in the addition of the Main folder

    Your changeset is checked in.

    Main folder checked in

When your team decides to branch the codebase, you can convert the Main folder to a branch. See Branch folders and files.

Add your code to version control

Create a new solution under version control

If you've got an idea for a new app, you can use version control from the start. Create a new code project (Keyboard: Ctrl + Shift + N), and add it to TFVC version control:

Creating a code project under TFVC version control

Tip

We suggest that you put your new project in c:\Users\YourName\Source\Workspaces\.

When the Choose Source Control dialog box appears, choose Team Foundation Version Control.

When you are ready, check in your changes (Keyboard: Ctrl + 0, P).

Put an existing solution under version control

You’ve already got an app in progress and you want to begin working on it under TFVC version control.

  1. Move your solution into your workspace folder (for example: c:\Users\YourName\Source\Workspaces\YourTeamProject\Main\).

  2. If you have not already done so, open your solution, (Keyboard: Ctrl + Shift + O) and then open Solution Explorer (Keyboard: Ctrl + Alt + L).

  3. Add your solution to source control.

    Adding a solution to version control

  4. On the Choose Source Control dialog box, choose Team Foundation Version Control.

  5. When you are ready, check in your changes (Keyboard: Ctrl + 0,P).

Q & A

Try this next

Set up a CI build

Dig deeper

Develop your app in Team Foundation version control