Dela via


Set Up Your Dev Machine and Start Using Version Control

Are you ready to set up your dev machine to take advantage of all the benefits of a version-controlled codebase? If you work in a simple codebase structure without branches, you can do this in just a few minutes and then rarely think about your workspace again.

Tip

Is your codebase structure complex? Does your team work in multiple branches? If so, you might get better results if you create one or more workspaces and then optimize them to meet your needs.

Before you start

Before you start working in version control, you must:

  • Install Team Foundation Server. How?

  • Install Visual Studio on your dev box. How?

  • Create a team project (if you don’t already have one). How?

Create your workspace

Required permissions

You must be one of the Contributors for your team project. See Team Foundation Server Default Groups, Permissions, and Roles.

To create your workspace

  1. In Windows, create the folder that will contain your code (including the solution, code projects, and the source code files). For example, this would be a good location for your folder: c:\code\SiteApp\.

    A great local root path for a workspace

    Why is this a good location?

  2. In Visual Studio, in Team Explorer:

    1. If you are not already connected to the team project that you want to work in, then connect to the team project.

    2. Choose Home iconHome, and then choose Source Control Explorer.

      Team Explorer Home page

  3. In Source Control Explorer, navigate to your team project. Choose Not mapped.

    Portal team project not yet mapped in a workspace

  4. Use the Map dialog box to map the root folder of your team project to the appropriate local folder. For example, you could map $/SiteApp to c:\code\siteapp.

    Map the team project root folder

  5. The system prompts you to download the files in the folder you just mapped.

    Download the files in the folder you just mapped

    Choose Yes.

After the files are downloaded, you are ready go get busy coding, unless you are beginning work in a new team project. In this case, before you get started, read on for a simple tip about folder structure.

Develop your code in the “Main” parent folder

Are you starting to work in a new team project? Then take this simple step when you set up your version control folder structure, and you’ll be ready when your team grows large enough for you to need branches to manage your work. There are just a few steps, and you don’t even have to think about or understand branches right now (unless you want to).

Put all your code in a parent called Main (for example: $/SiteApp/Main/).

Required permissions

You must be one of the Contributors for your team project. See Team Foundation Server Default Groups, Permissions, and Roles.

To develop your code in the “Main” parent folder

  1. On the menu bar choose View, Other Windows, 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

    Type Main and choose the Enter key.

  4. Open the shortcut menu of the Main folder and choose Check in.

    Check in the addition of the Main folder

  5. The Check-in Confirmation dialog box appears.

    Check-in Confirmation

    Select Don’t prompt again and choose Yes.

  6. Your changeset is checked in.

    Main folder checked in

    Get busy building your app. Make sure to put your code (including solutions, code projects, source files) in the Main folder that you just created.

Next steps

Now that your workspace is set up, you are almost ready to begin developing code and writing tests.

  • If you don’t yet have one, create a new code project. In Visual Studio, on the menu bar choose File, New, Project.

  • Add your existing code to source control. How?

  • Download your team’s code into your workspace (if you did not already do so when you created your workspace). How?

  • Use Source Control Explorer to manage your files. How?

  • Optimize your workspace or create additional workspaces. How?