Share via


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

Team Foundation version control lets you add items to the server that are not necessarily affiliated with a project or solution. An example is a file created by a third-party language that is independent of the Visual Studio solution. Files and folders can be added to the server from either the command line or from Source Control Explorer, as described in the following procedures. For more information, see Add Command or Source Control Explorer.

Note

You cannot add an empty folder, or a folder that contains a file that has pending changes.

Adding Items from the Command Line

Add is a pending change command that schedules the items that you specify for addition to the server, pending the completion of a check-in operation from your workspace.

To perform a pending change command, your current directory must be added to a workspace and thereby mapped to a server. For more information about how to add your current directory to a workspace, see Add and Remove a Working Folder in a Workspace or Workfold Command.

Note

Adding folders and files in this manner does not add binding data for Visual Studio. The binding is responsible for providing version control functionality. This includes various version control icons that indicate status in Solution Explorer. If you want to bind the folders and files you added, you must bind them in a separate operation. For more information, see Bind and Unbind Projects and Solutions.

For information about adding solutions and projects to the server, see Add Files 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 a file to the server from Source Control Explorer

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

  2. In Source Control Explorer, go to the solution where you want to add the file.

    The solution must already be in a mapped folder in your local workspace and 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 Create a Workspace and Get Files.

  1. In the Exclude 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.

  2. Click Add Files.

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

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

To add a folder to the server from Source Control Explorer

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

  2. In Source Control Explorer, go to the solution where 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 Create a Workspace and Get Files.

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

  2. Click Add Folder.

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

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

To add an item to the list of pending changes from the command line

  1. Open a Visual Studio 2008 Command Prompt by clicking the Start button, click All Programs, click Microsoft Visual Studio 2008, click Visual Studio Tools, and then click Visual Studio 2008 Command Prompt.

    This sets the command prompt environment for using it with Visual Studio 2008 tools.

  2. Change directories to a mapped folder in your local workspace. The file or folder you want to add must also be in a mapped local folder.

  3. Type tf add itemspec, for example, myfile.cs.

See Also

Tasks

Bind and Unbind Projects and Solutions

Reference

Add Command

Checkin Command