Поделиться через


How to: Delete Files and Folders from Source Control

Files and folders can be deleted from the server from either Source Control Explorer, Solution Explorer, or from the command line. For more information, see Delete Command (Team Foundation Source Control) or follow the procedures in this topic.

Deleting Items from the Command Line

Delete is a pending change command that schedules the items that you specify for deletion 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.

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 delete a file or folder to the server from Source Control Explorer

  1. On the View menu, click Other Windows, and then click Source Control Explorer if it is not already open.

  2. In Source Control Explorer, locate the team project and folder or file that you want to delete.

  3. In the right pane, right-click the file or folder, and then click Delete.

    You are returned to Source Control Explorer with the file or folder marked for deletion under the Pending Change column. For more information, see How to: Identify Source Control Item Status in Source Control Explorer.

    Deleting a file upon which other files have dependencies will also mark the dependent files for deletion. For example, if you delete a form file, the code and resource file will also be marked for deletion.

    Note

    If you delete a folder in which files reside, the files will also be marked for deletion.

To delete a folder to the server from Solution Explorer

  1. On the View menu, click Solution Explorer if it is not already open.

  2. In Solution Explorer, locate the team folder or file that you want to delete.

  3. Right-click the folder and click Delete.

  4. On the View menu, click Other Windows, and then click Source Control Explorer if it is not already open.

  5. In Source Control Explorer, note the file or folder you deleted in Solution Explorer is marked for deletion under the Pending Change column.

    For more information, see How to: Identify Source Control Item Status in Source Control Explorer.

    Deleting a file upon which other files have dependencies will also mark the dependant files for deletion. For example, if you delete a form file, the code and resource file will also be marked for deletion.

    Note

    If you delete a folder in which files reside, the files will also be marked for deletion.

To add a deleted item to the server 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 delete <file or folder name>.

  3. Type tf checkin.

See Also

Tasks

How to: Bind and Unbind Projects and Solutions

Reference

Delete Command (Team Foundation Source Control)
TFSDeleteProject

Concepts

Troubleshooting Source Control Issues

Other Resources

Working with Source Control Files and Folders