How to: Delete Files and Folders from Version Control

You can delete files and folders from the server by using either Source Control Explorer or Solution Explorer, or by using the command line. For more information, see Delete Command (Team Foundation Version 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, you must add your current directory to a workspace and thereby map it 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 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 mark a file or folder for deletion from Source Control Explorer

  1. On the View menu, click Other Windows, and then select 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.

    The system then returns you to Source Control Explorer with the file or folder marked for deletion under the Pending Change column.

    Deleting a file on 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.

    The file will be deleted from Team Foundation version control after you check-in pending changes. For more information, see How to: Check In Pending Changes.

    Note

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

To mark a file or folder for deletion 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. A confirmation dialog box with the text <file name> will be deleted permanently appears.

  4. Click OK. The item disappears from Solution Explorer.

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

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

    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.

    The file will be deleted from Team Foundation version control after you check-in pending changes. For more information, see How to: Check In Pending Changes.

    Note

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

To delete an item 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. Navigate to the mapped folder where the item you want to remove is located.

    Type tf delete <file or folder name>.The file will be deleted from Team Foundation version control after you check-in pending changes. For more information, see Checkin Command.

See Also

Tasks

How to: Bind and Unbind Projects and Solutions

Concepts

Troubleshooting Version Control Issues

Reference

Delete Command (Team Foundation Version Control)

Other Resources

Working with Version Control Files and Folders