Rename or move files and folders

You can rename and move files and folders in both Solution Explorer and Source Control Explorer.

Important note Important

Avoid renaming items under version control using your operating system (for example, using File Explorer, or the rename command in the Windows command prompt). Instead, you should follow the procedures below to rename your files and folders. Otherwise, you might get unintended results.

Required permissions

You must be one of the Contributors for your team project. See Team Foundation Server default groups, permissions, and roles.

What do you want to do?

Important note Important

If you need to move a folder or a file that is referenced by a code project, use Solution Explorer so that the system updates the references.

To move an item that is referenced by a code project

  • In Solution Explorer, drag the folder or the file to the new location in Solution Explorer.

You can use Source Control Explorer one file or folder at a time. You should not use Source Control Explorer to move folders or files that are referenced by a code project.

To move an item

  1. In Source Control Explorer, select the item that you want to move, open its shortcut menu, and choose Move.

  2. In the Move dialog box, either manually type the destination for the item in the To box, or choose Browse to use the Browse for Folder dialog box.

  3. Choose OK.

You can use either Source Control Explorer or Solution Explorer to rename a file. If you use Source Control Explorer, you can also change the file extension.

To rename an item

  1. In either Solution Explorer or Source Control Explorer, select the file that you want to edit, open its shortcut menu, and choose Rename.

  2. Type the desired name for the item.

You should avoid renaming items under version control using your operating system (for example, using Windows File Explorer, or the rename command in the Windows command prompt). When you have used your operating system to rename an item in in a local workspace, Visual Studio detects the change as two changes: an add and a delete. You can join the two actions into a rename action.

To fix the results of an operating system rename

  1. In Visual Studio, in Team Explorer, choose Home icon Home, and then choose Pending Changes.

  2. In the Excluded Changes section, choose the Detected changes link.

  3. In the Promote Candidate Changes dialog box, select the delete and add actions, open their shortcut menu, and choose Promote as Rename.

  4. A single rename change now appears in the Included Changes section.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft