visual-studio 删除 TFS 中的文件夹

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2655505/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 11:47:20  来源:igfitidea点击:

Deleting a folder in TFS

visual-studiotfsdirectory

提问by Mark Kadlec

I created a folder in a TFS Project under workspace "CPortalWS". I deleted the workspace, but now I would like to delete the folder in the project and the delete option is not available.

我在工作区“CPortalWS”下的 TFS 项目中创建了一个文件夹。我删除了工作区,但现在我想删除项目中的文件夹,并且删除选项不可用。

I've tried to create a new workspace mapped to the project but I still don't get the option to delete.

我试图创建一个映射到项目的新工作区,但我仍然没有选择删除。

Is this a bug in TFS? How can I delete the folder?

这是 TFS 中的错误吗?如何删除文件夹?

Any help would be appreciated.

任何帮助,将不胜感激。

回答by Justin Niessner

Deleting a folder in TFS is a little strange.

在 TFS 中删除文件夹有点奇怪。

You have to:

你必须:

  • Create a Workspace

  • Get the latest source for the folder (to your local machine)

  • Inside Source Explorer, delete the folder

  • Check in your changes (this is the step that deletes the folder in Source Control)

  • 创建工作区

  • 获取文件夹的最新源(到您的本地机器)

  • 在 Source Explorer 中,删除文件夹

  • 签入您的更改(这是在源代码管理中删除文件夹的步骤)

回答by undertakeror

only note that delete is not an actual delete. the folders/files are still there and kept in Version Control, for example for Undelete scenarios. You can see them and avail the undelete function if you go to "Tools > Options > Source Control > Visual Studio Team Foundation Server" and check "Show deleted items in the Source Control Explorer" and then right-click on one of the deleted folders.

只需要注意删除不是实际删除。文件夹/文件仍然存在并保存在版本控制中,例如用于取消删除方案。如果您转到“工具>选项>源代码管理>Visual Studio Team Foundation Server”并选中“在源代码管理资源管理器中显示已删除的项目”,然后右键单击已删除的文件夹之一,则可以看到它们并使用取消删除功能.

so, if you want real delete, where the folder/files actually go away you need to use the Destroy Command which is only available from the command line, see link below

因此,如果您想真正删除文件夹/文件实际上消失的地方,您需要使用仅可从命令行使用的销毁命令,请参阅下面的链接

http://msdn.microsoft.com/en-us/library/bb386005.aspx

http://msdn.microsoft.com/en-us/library/bb386005.aspx

回答by Donal

When you delete in TFS, it does not remove it from TFS. It maintains a copy of the deleted files, even when you check in the deletion. This can cause some issues. To permanently delete from TFS, you need to issue a tfs destroycommand.

当您在 TFS 中删除时,它不会将其从 TFS 中删除。即使您签入删除操作,它也会保留已删除文件的副本。这可能会导致一些问题。要从 TFS 中永久删除,您需要发出tfs destroy命令。

To do this:

去做这个:

  1. Open a Visual Studio Command Prompt.
  2. Issue the following command: tf destroy $/SourceLocation/Folder. Where $/SourceLocation/Folder is the Source location of the deleted folder in TFS.
  1. 打开 Visual Studio 命令提示符。
  2. 发出以下命令:tf destroy $/SourceLocation/Folder. 其中 $/SourceLocation/Folder 是 TFS 中已删除文件夹的源位置。

Please note: This command will also delete the file(s) from disk.

请注意:此命令还将从磁盘中删除文件。

enter image description here

在此处输入图片说明

回答by Sreeni

Create a Workspace; and get latest on the base folder; Dont forget to cloak the relevant folders. If you are going to delete the subfolders then cloak all and get latest on the base folder. So you save a lot of time in pulling files.

创建工作区;并在基本文件夹中获取最新信息;不要忘记隐藏相关文件夹。如果您要删除子文件夹,则隐藏所有文件夹并获取基本文件夹的最新信息。因此,您可以节省大量时间来提取文件。

回答by Dave

I had a similar issue, where I had 1 folder which despite being deleted from Hard drive, was still showing as in Source Control (with a green + by the folder). It also showed me the content but if I tried to open any, an error message informed me the file wasn't there.

我有一个类似的问题,我有 1 个文件夹,尽管已从硬盘驱动器中删除,但仍显示为源代码管理(文件夹旁带有绿色 +)。它还向我显示了内容,但是如果我尝试打开任何内容,则会出现一条错误消息,通知我该文件不存在。

Clicking on any folder didn't show the delete button. I then realised that selecting a file did! If you don't have a file, create a text file and add it to the folder you want to delete (via Source Control). Click this file, note the delete shows. Select a folder and note that the delete disappears but only after half a second. This small delay is actually usable.

单击任何文件夹都没有显示删除按钮。然后我意识到选择文件确实如此!如果您没有文件,请创建一个文本文件并将其添加到您要删除的文件夹中(通过源代码管理)。单击此文件,注意删除显示。选择一个文件夹并注意删除消失但仅在半秒后消失。这个小的延迟实际上是可用的。

I clicked the file, so the delete button is enabled and hovered the mouse above the delete button. Using the keyboard, I did a CTRL+ Aand as soon as all files and folders were selected I clicked left mouse button. And it worked! Everything was removed, including (and this is the odd thing) the parent folder.

我单击了该文件,因此启用了删除按钮并将鼠标悬停在删除按钮上方。使用键盘,我做了一个CTRL+ A,一旦选择了所有文件和文件夹,我就单击了鼠标左键。它奏效了!一切都被删除了,包括(这很奇怪)父文件夹。