Bagikan melalui


Add Files to Version Control

If your team uses Visual Studio Team Foundation Server, you can add files from your local computer to version control. When the files are in version control, other members of your development team can access them to edit, build, and test their work locally.

Important

Before you can use version control in Team Foundation, you must have access to a team project. For more information, see Creating a Team Project.

You can add files from your local computer to version control by following the procedures in this topic. For information about how to add files by upgrading from a previous version of Team Foundation Server or by migrating from Visual SourceSafe, see Upgrading Team Foundation Server or Migrate from Visual SourceSafe.

Required Permissions

To perform these procedures, your Check out permissions must be set to Allow. For more information, see Team Foundation Server Permissions.

In this topic

  • To add a solution or project to version control

  • To create a solution and add it to version control

  • To add a file that is not in a solution to version control

To add a solution to version control

  1. On your computer, make sure that the solution that you are adding is in a location that you want to use as a local working folder for that solution.

    Note

    The local working folder is where you will do your development work for that solution. For more information, see Create and Work With Workspaces.

  2. Open Visual Studio, and connect to the team project to which you want to add the solution.

    For more information, see Connect to and Access Team Projects in Team Foundation Server.

  3. In Visual Studio, open your solution.

  4. In Solution Explorer, right-click your solution, and then click Add Solution to Source Control.

    The Add Solution to Source Control dialog box appears.

  5. Under Team Project Location, specify the folder on the version-control server to which you want to add your solution.

  6. In Type a name for the solution folder, type a name for the subfolder that will be created for your solution, and then click OK.

    Note

    At this point, the solution is scheduled to be added to version control pending a check-in operation.

  7. To commit the addition of the solution to the server, in Solution Explorer, right-click your solution again, and then click Check In.

  8. In the Check In dialog box, type an appropriate comment, such as Adding source files to version control, and then click Check In.

To create a solution and add it to version control

  1. Open Visual Studio, and connect to your team project.

    For more information, see Connect to and Access Team Projects in Team Foundation Server.

  2. On the File menu, click New, and then click Project.

  3. In the New Project dialog box, specify the type of project that you want to create and options for it.

  4. In the Location list, specify the local working folder for the solution.

    Note

    The local working folder is where you will do your development work for that solution. For more information, see Create and Work With Workspaces.

  5. Select the Add to source control check box, and then click OK.

    The Add to source control dialog box appears.

  6. Under Team Project Location, specify the folder on the version-control server to which you want to add the solution.

  7. Under Type a name for the solution folder, type a name for the subfolder that will be created for your solution, and then click OK.

    Note

    At this point, the solution is scheduled to be added to version control pending a check-in operation.

  8. To commit the addition of the solution to the server, in Solution Explorer, right-click your solution, and then click Check In.

  9. In the Check In dialog box, type an appropriate comment, such as Adding source files to version control, and then click Check In.

To add a file that is not in a solution to version control

  1. On your computer, make sure that the file that you are adding is in a location that you want to use as a local working folder for that file.

    Note

    The local working folder is where you will do your development work for that file. For more information, see Create and Work With Workspaces.

  2. Open Visual Studio, and connect to your team project.

    For more information, see Connect to and Access Team Projects in Team Foundation Server.

  3. In Team Explorer, double-click Source Control.

  4. In the Source Control window, specify the folder on the version-control server to which you want to add the file.

    Tip

    To display the list of folders in Source Control Explorer, click the Folders icon in the window’s task bar.

  5. In Source Control Explorer, right-click the folder into which you want to add the file, and then click Add Items to Folder.

  6. In the Add to Source Control dialog box, do one of the following:

    • If the folder is already mapped, click Finish.

    • If the folder is not mapped, click Map.

      The Map dialog box appears.

      1. In Local folder, make sure that the path is correct, and then click Map.

      2. In the Add to Source Control dialog box, click Finish.

    Note

    At this point, the file is scheduled to be added to version control pending a check-in operation.

  7. To commit the addition of the file to the server, in Solution Explorer, right-click the file, and then click Check In.

  8. In the Check In dialog box, type an appropriate comment, such as Adding modeling diagram to version control, and then click Check In.

See Also

Tasks

Create a Team Project

Concepts

Connect to and Access Team Projects in Team Foundation Server

Scenario: Upgrading Team Foundation Server