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
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.)