Share via


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

Team Foundation source 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 How to: 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 source control functionality. This includes various source 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 How to: Bind and Unbind Projects and Solutions.

For information about adding solutions and projects to the server, see How to: Add a Project or Solution to Source 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, locate to the solution where you want to add the file.

  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 click 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 Workspace.

  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, locate and select the file that you want to add to source 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, locate 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 click 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 Workspace.

  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, locate and select the folder that you want to add to source 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 2005 Command Prompt by clicking the Start button, click All Programs, click Microsoft Visual Studio 2005, click Visual Studio Tools, and then click Visual Studio 2005 Command Prompt.

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

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

  3. Type tf checkin.

    Note

    For the full syntax of the Add and Checkin command, see Add Command and Checkin Command.

See Also

Tasks

How to: Bind and Unbind Projects and Solutions

Reference

Add Command
Checkin Command

Other Resources

Working with Source Control Files and Folders