views:

39

answers:

1

I have a file, xyz.cs, open in Visual Studio 2008. If I open a solution, xyz.cs is closed, and VS opens up the files listed in the SUO for the solution.

I open another file (in this case a file not included in the solution, we'll call it abc.cs). Then, I close the solution, at which point all open files (including abc.cs) are closed. In addition, xyz.cs remains closed. The only thing that remains open is my TFS source control explorer.

Is there a way I can prevent this automatic file closing behavior? Is there a reason this behavior exists that would provide incentive not to prevent this behavior?

Edit: note that no file checkouts are expected in this scenario.

+1  A: 

The solution contains source control settings (amongst other things), so if you were to open (and edit) a file from outside of the context of a solution it would not be properly checked out, unless it already is checked out (and thereby is not readonly). To overcome your problem you can either create a solution that contains both the files (and projects) or open two instances of VS.

klausbyskov
I'm not sure creating a new throwaway solution every time I want to keep a file open is a good workaround for me.Using a second instance of VS is a valid workaround, but the level of inconvenience involved with that makes it nontrivial enough to justify solving the root issue.
stack
+1 for opening two VS instances. It's a rare day that I don't have 2 or 3 of them going. @stack: this is the behavior of the program and unless you are on the VS Dev team (or know someone who is) I seriously doubt the behavior will be changed.
Chris Lively
I appreciate your response that you agree with klausbyskov.
stack
I suppose I should also note that it's also a rare day for me that I don't have two or three instances of VS up all the time. This actually makes my issue a bigger one, as opening up more and more instances of VS can only go so far.
stack
Thinking about klausbyskov's response a bit more, I'm not sure I understand the first sentence. At least for me, TFS doesn't care what solution a file is associated with -- I can check out any arbitrary file at any time, so the solution shouldn't be an issue. Regardless, I'm more concerned with read only access in this scenario.
stack

related questions