Excel 文件保存后从解决方案资源管理器中消失
设置:Windows 7、Visual Studio 2010(带有 TFS2010*)、Excel 2007 Full/2010 Starter
重现步骤:
- 在空的 Visual Studio 中,单击“文件”->“Excel 2007 Full/2010 Starter”。新项目->空白解决方案,记下解决方案目录,然后单击“确定”
- 打开 Excel 并创建一个新的 Excel 文件,将其保存在新的解决方案目录中,然后关闭 Excel
- 在解决方案资源管理器中右键单击新的解决方案 ->添加->现有项目
- 选择 Excel 文件,一旦添加到解决方案,它应该自动在 Excel 中打开(如果没有,则手动打开)
- 保存 Excel 文件 文件
- 从解决方案资源管理器中消失
有谁知道如何阻止此情况发生?
** 我不认为 TFS 与这种情况有任何关系,但为了完整性我添加了它
Set-up: Windows 7, Visual Studio 2010 (with TFS2010*), Excel 2007 Full/2010 Starter
Reproduction steps:
- In an empty Visual Studio, click on File -> New Project -> Blank Solution, note the solution directory and click on OK
- Open Excel and create a new Excel file, save it in the new Solution directory, then close Excel
- Right-click on the new Solution in Solution Explorer -> Add -> Existing Item
- Select the Excel file, and once added to the solution, it should automatically open in Excel (if it doesn't, then open it manually)
- Save the Excel file
- The file disappears from Solution Explorer
Does anyone know how to stop this from happening?
** I don't think TFS has anything to do with the situation, but I've added it for completeness
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
IMO 这是 Visual Studio 中的一个错误。我已经多次见证过这一点。解决方案项目似乎会定期消失,并且似乎是通过修改 VS 外部的解决方案文件来触发的。很多时候,我用较新的版本复制了一个文件,也许是因为该文件被暂时删除,然后由副本重新创建,VS 检测到短暂的删除并认为应该将其从解决方案中删除。 (我所说的瞬间可能是毫秒。)
使用 TFS 时,通常当我去签入某些内容时,我会注意到解决方案文件已签出,即使我没有编辑它,并且当我比较 sln 文件时我意识到 VS 认为解决方案文件已被删除,所以我必须撤消 sln 文件的签出。事实上,这已经多次困扰着我,以至于现在每当我检查 sln 文件时,我都会对其进行比较,以确保 VS 不会试图从我身边溜走。
(由于这个问题,我还花了相当多的时间来修复其他团队成员意外签入 sln 文件的问题。)
IMO this is a bug in Visual Studio. I have witnessed this many times. Solutions items seem to vanish periodically, and it seems to be triggered by modifying a Solution file outside of VS. Many times I have copied over a file with a newer version, and perhaps because the file is momentarily deleted and then recreated by the copy, VS detects the short-lived deletion and thinks it should be removed from the solution. (By momentarialy I mean perhaps a ms.)
When using TFS, oftentimes when I go to check in something, I'll notice the solution file is checked out, even if I didn't edit it, and when I compare the sln file I realize VS thought a solution file was deleted, so I have to undo the checkout of the sln file. In fact, this has bit me in the butt so many times that now anytime I am checking in the sln file I compare it just to make sure VS didn't try to slip one past me.
(And I've also spent quite a few hours of my life fixing accidental checkins of the sln file by other team members due to this issue.)