David Starkey
David Starkey

Reputation: 1840

Unable to delete renamed folders

I was renaming several files/folders when VS decided that would be the perfect time to crash. On re-opening, I now have 2 versions of the folders I renamed, one with the old name and one with the new. The new folders were not linked to source control, so I added each of them. Now, when trying to delete the old ones, I get the following error:

This operation cannot be completed. You are attempting to remove or delete a source-controlled item where the item is exclusively locked elsewhere or otherwise unable to be deleted from source control.

I know no one else had those files checked out, and all the files in them have the little green + as if they are new files. I can delete all those files so the folder is empty, but I still cannot delete it. I'm also unable to exclude the folder from project.

If I open a file explorer, I can delete the old folder and then VS will allow me to delete the folder. However, when trying to rename one of the folders back, it gives the error above, even though the folder had been deleted.

My internet searching powers are coming up short and I'm not sure what else to try. Any ideas on how I can fix this?

In case it matters, the affected folders contain .cs, .cshtml, and .js files. The OS is Windows 10.

Upvotes: 0

Views: 330

Answers (1)

Andy Li-MSFT
Andy Li-MSFT

Reputation: 30362

Generally the files/folders are not really deleted from TFS as they are in source control, unless you permanently destroy them, See Destroy Command.

Files and folders under version control can be easily moved, renamed, and deleted from Source Control Explorer. (Make sure you have these folders mapped in your workspace.)

Just check and try below things:

  • Note that you cannot delete a folder that has pending changes on any of its children (including if any of those children are being moved out of the folder – they’re still children until that changeset is checked in.)

    So, in this case you need to move the children out of the folder and check those changes in, then delete the folder as a separate changeset.

  • Besides in earlier version of TFS and VS have some problems with deleting empty folders. In this case you can try creating an item inside the folder you are trying to delete. After that try deleting again. See this article for details.
  • You can also try to delete the renamed folder from the command line. Se Delete Command (Team Foundation Version Control) for details.
  • Get latest first, then try deleting again.
  • Remap the workspace or create a new workspace and map to a new location, then try deleting again.

Upvotes: 1

Related Questions