简体   繁体   English

TFS2008和VS2008:从解决方案资源管理器中删除的文件仍显示在源代码管理资源管理器中

[英]TFS2008 & VS2008 : File deleted from Solution Explorer still appears in Source Control Explorer

I'm seeing some weird behavior from VS2008 integrate with TFS 2008. When I delete a file from a solution from within the Solution Explorer and check it in, the file still appears in the Source Control Explorer. 我看到VS2008与TFS 2008集成了一些奇怪的行为。当我从解决方案资源管理器中的解决方案中删除文件并将其检入时,该文件仍显示在源代码管理资源管理器中。

In the Source Control Explorer the file appears having the value 'delete' under the Pending Change column. 在“源代码管理资源管理器”中,文件显示为“待更改”列下的值为“删除”。 It also appears in the Pending Changes window with the same status and I'm forced to check it in from there. 它也以相同的状态显示在“待更改”窗口中,我被迫从那里检入。

Any idea whether this is "normal" and if it is, what the rationale behind it is? 知道这是否“正常”吗?如果知道,其背后的原理是什么? How can I avoid having to twice check-in the file deletion? 如何避免必须两次检入文件删除?

How did you check in, exactly? 您是如何办理入住手续的? My guess is you did it from the Solution Explorer context menu. 我的猜测是您是从解决方案资源管理器上下文菜单中完成的。 When the Checkin modal dialog pops up, even though it shows your entire list of pending changes, by default only items that are currently in the solution will be checked. 当“签入”模式对话框弹出时,即使它显示了待处理更改的整个列表,默认情况下,仅会检查解决方案中当前存在的项目。

This is another reason why I don't recommend invoking important operations from Solution Explorer. 这是为什么我不建议从解决方案资源管理器调用重要操作的另一个原因。 Automatically pending changes for you is convenient, but operations that modify state (eg Get, Checkin, Shelve) deserve more care. 自动挂起的更改对您来说很方便,但是修改状态的操作(例如,获取,签入,搁置)值得您多加注意。

Edit: to reflect comment. 编辑:反映评论。

This is strange I don't get this behavior and nor does anyone at our sites. 很奇怪,我没有这种行为,我们的网站上也没有人。 If we delete a file in Solution Explorer (select file and hit delete) it becomes a pending change. 如果我们在解决方案资源管理器中删除文件(选择文件并单击删除),它将成为一个待定更改。 Then I can checkin the change. 然后,我可以签入更改。 I have to ensure that I select the deletion in the check in/pending changes windows. 我必须确保在“签入/待更改”窗口中选择删除。 Then It no longer appears as a pending change in Source Explorer. 然后,它不再显示为Source Explorer中的待定更改。 In fact I can check in and check out in either window and the change is reflected in the other instantly. 实际上,我可以在任一窗口中签入和签出,更改会立即反映在另一个窗口中。

==== ====

Deleted files remain in TFS. 删除的文件保留在TFS中。 To completely remove a file you have to 'DESTROY' it not delete it. 要完全删除文件,您必须“销毁”它而不是删除它。 This is essentially source control in action. 这实际上是源代码控制。 If you don't want to see the file then there is a setting in visual studio to hide them. 如果您不想看到文件,则Visual Studio中有一个设置可以隐藏它们。 Personally I prefer them there, as you can see the history and they are a visual reminder. 我个人比较喜欢它们,因为您可以看到历史记录,并且它们是视觉上的提醒。

After deleting the file, you need to commit the deletion - this is essentially checking in the deletion. 删除文件后,您需要提交删除操作-这实际上是检查删除操作。 After this the file will remain in the source explorer but be greyed out. 此后,文件将保留在源浏览器中,但显示为灰色。 You can then do things like I mention above. 然后,您可以做上面我提到的事情。

What is the setting of Tools | “工具”的设置是什么? Options | 选项| Source Control | 源代码管理| Visual Studio Team ... | Visual Studio团队... | Show Deleted Files in the Source Control Explorer? 在源代码管理资源管理器中显示已删除的文件?

This defaults to unset, but if it has been set then deleted files will appear. 默认为未设置,但如果已设置,则会显示已删除的文件。

Ung, g

This behaviour is totally normal - if somewhat confusing - as when you delete a file from a solution, that file is marked as pending delete in Source Control, but when you check in via the Solution Explorer, at the point of check-in that file no longer falls under the scope of the Solution. 此行为是完全正常的-如果有些令人困惑-例如当您从解决方案中删除文件时,该文件在Source Control中被标记为待处理删除,但是当您通过Solution Explorer签入时,在签入该文件时不再属于解决方案的范围。

If you delete files from a solution at any point, just remember to check-in from the Source Control Explorer. 如果您随时从解决方案中删除文件,只需记住从Source Control Explorer中检入即可。

Antony 安东尼

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM