Partager via


Rename or delete a file under source control

You can use Blend for Visual Studio 2012 to rename or delete files that are under source control.

[!REMARQUE]

Other team members will not see files that you rename or delete until you check in your changes. Because each of the following procedures adds a line to the project file (.csproj, .vbproj), you might have to merge your changes if another team member modifies the project file while you have it checked out. For more information, see Merge and resolve conflicts when checking files in.

For information about using Microsoft Visual Studio Team System Team Explorer to rename or delete files, see How to: Move, Rename, and Delete Version-Controlled Files and Folders on MSDN.

To rename a file under source control

  1. In the Projects panel, right-click the file, and then click Rename.

    The name of the file becomes editable.

  2. Type a new name, and then press ENTER.

    The file is renamed. In the Projects panel, a rename icon is displayed next to the file to show that it has been renamed but not yet checked in. The project file is updated to reference the new file name. A check mark JJ170996.62863683-36e0-4c3e-818f-ffe18a7fec91(fr-fr,VS.110).png is displayed next to the project file to show that it is checked out to you.

  3. Check in the renamed file and the modified project file. For more information, see Check files in and out.

    Mise en gardeAttention

    Do not modify the contents of a renamed file before checking in the file name change. If you do, the changes will not be checked in when you check in the name change because Microsoft Team Foundation source control regards renaming as an action that is distinct from modification.

To delete a file under source control

  1. In the Projects panel, right-click the file, and then click one of the following:

    • Delete   This will disassociate the file from the project and delete the file from the project folder.

    • Remove from Project   This will disassociate the file from the project but will not delete the file from the folder. You can add the file to the project again by right-clicking the project and then clicking Add Existing Item.

    The project file is updated to remove the reference to the removed file. A check mark JJ170996.62863683-36e0-4c3e-818f-ffe18a7fec91(fr-fr,VS.110).png is displayed next to the project file in the Projects panel to show that it is checked out to you.

    ConseilConseil

    Deleted and removed files are no longer displayed in the Projects panel, but you can view the list of deleted files at any time by following the steps in Undo or view the list of pending changes.

  2. Check in the changes you have made by right-clicking the project from which you deleted the files, and then clicking Check In. In the Check In dialog box, make sure that both the deleted file and the project file are selected before clicking Check In.

Voir aussi

Tâches

Check files in and out

Undo or view the list of pending changes

Refresh the status of files under source control