Bagikan melalui


How to: Add Non-Project or Non-Solution Files and Folders to Version Control

Add items to the version control server from either the command line or from Source Control Explorer. When you specify items to be added to version control, a pending change is created. A check-in operation commits the changes to the version control server from your workspace. For more information, see Add Command or Source Control Explorer.

For information about how to add solutions and projects to the server, see How to: Add a Project or Solution to Version Control.

Required Permissions

To perform these procedures, you must have the Check out permission set to Allow. For more information, see Team Foundation Server Permissions.

To add non-project or non-solution files and folders to version control, perform the following procedures:

  • Adding Files or Folders to Version Control

  • Adding Items by using the Visual Studio 2008 Command Prompt

  • Adding Files or Folders with the Service Pack 1 Edition of Team Foundation Server 2008

Adding Files or Folders to Version Control

Use the following procedures to add files and folders to version control by using Team Foundation Server 2008.

To add a file to the server by using Source Control Explorer

  1. On the View menu, click Other Windows, and then click Source Control Explorer.

  2. In Source Control Explorer, locate the solution to which you want to add the file.

    Note

    The solution must already be in a mapped folder in your local workspace. In addition, the file or folder you want to add must also be in a mapped local folder.

  3. On the File menu, click Source control, and then click Add To Source Control.

    The Add to Source Control dialog box appears.

    Note

    If you cannot select Add To Source Control, it may be because you have not created a workspace for the current project. For more information, see How to: Create a Mapped Workspace.

  4. In the Exclude box, type the file name extensions that you do not want to add. You can enter multiple file type extensions by using commas and wildcard characters. For example, *.pdb, *.obj, *.res.

  5. Click Add Files.

  6. In the Add to Source Control dialog box, select the file that you want to add to version control, and then click OK.

  7. In the Add to Source Control dialog box, click OK.

To add a folder to the server by using Source Control Explorer

  1. On the View menu, click Other Windows, and then click Source Control Explorer.

  2. In Source Control Explorer, locate the solution to which you want to add the items.

  3. On the File menu, click Source control, and then click Add To Source Control.

    The Add to Source Control dialog box appears.

    Note

    If you cannot select Add To Source Control, it may be because you have not created a workspace for the current project. For more information, see How to: Create a Mapped Workspace.

  4. In the Exclude box, type the file name extensions that you do not want to add. You can enter multiple file type extensions that use commas and wildcard characters. For example, *.pdb, *.obj, *.res.

  5. Click Add Folder.

  6. In the Browse for Folder dialog box, select the folder that you want to add to version control, and then click OK.

  7. In the Add to Source Control dialog box, click OK.

Adding Items by using the Visual Studio 2008 Command Prompt

Use the following procedure to add items by using the Team Foundation Server 2008 command prompt.

To add an item to the list of pending changes by using the command prompt

  1. Click Start, click All Programs, click Microsoft Visual Studio 2008, click Visual Studio Tools, and then click Visual Studio 2008 Command Prompt.

  2. Change directories to the mapped folder in the local workspace that contains the file or folder you want to add.

  3. Type tf add and the item specification of the item you want to add**.**

    For example, tf addmyfile.cs.

    For more information, see Add Command.

Adding Files or Folders with the Service Pack 1 Edition of Team Foundation Server 2008

Use the following procedures to add items to version control by using the Service Pack 1 edition of Team Foundation Server 2008 and Team Explorer.

Important noteImportant Note:

This functionality is only available with the Service Pack 1 edition of Team Foundation Server 2008.

To add a file or folder to the version control server by using Source Control Explorer

  1. On the View menu, click Other Windows, and then click Source Control Explorer.

  2. In Source Control Explorer, select the folder to which you want to add a file or folder.

    The solution does not have to already be in a mapped folder in a local workspace. The file or folder you want to add can be in any local folder.

  3. On the File menu, click Source control, and then click Add Items to Folder. You can alternatively right-click the folder in Source Control Explorer, and then click Add Items to Folder.

  4. On the Add to Source Control dialog box, in the Look in box or by using the Browse button, locate the files you want to add.

  5. Optional. In the Automatically exclude from source control text box, type the file name extensions that you do not want to add. You can enter multiple file type extensions by using commas and wildcard characters. For example, *.pdb, *.obj, *.res.

  6. If the version-controlled folder you selected is not already mapped to a local folder, the Map button is active. Click Map to locate a local working folder and map the files in the version-controlled folder.

    If the folder is already mapped, you can optionally click Advanced to view the Destination local folder.

    For more information about mapping, see Version Control Workspaces and Mapping and How to: Create a Mapped Workspace.

  7. In the Select items to add to source control pane, select the files or folders you want to add.

  8. Click Next.

  9. To add the items that are displayed in the Excluded items tab, select one or more item, and then click Include Item(s).

    Note

    If the item is already included in the version control folder, you cannot add it to the Items to add tab.

  10. To exclude the items that are displayed in the Items to add tab, select one or more item, and then click Exclude item(s).

  11. Click Finish to add the files or folders in the Items to add tab to version control.

    The files and folders you selected are displayed in Source Control Explorer. After you have added the items, you must check them in as pending changes. For more information, see How to: Check In Pending Changes.

To add files or folders to Source Control Explorer by using a drag-and-drop operation

  1. Click Start, click My Computer, and then locate the files and folders you want to add to version control.

    Important noteImportant Note:

    This functionality is only available with the Service Pack 1 edition of Team Foundation Server 2008.

  2. In a drag-and-drop operation, move the files or folders to the right-hand pane of Source Control Explorer.

    • If you are adding a single file, it is now added to the folder.

    • If you are adding one or more files or folders, the Add to Source Control dialog box appears with the selected items listed in either the Items to add or Excluded Items tabs.

      Click Finish to add the items to version control.

  3. The files and folders you selected are displayed in Source Control Explorer. After you have added the items, you must check them in as pending changes. For more information, see How to: Check In Pending Changes.

See Also

Tasks

How to: Bind and Unbind Projects and Solutions

Reference

Checkin Command

Other Resources

Working with Version Control Files and Folders