Automatic Check-Out Not Working with VSTS/TFS

For the last little while I have been having an issue using source control under TFS. Specifically, when I go to edit a file that (I believe) is under source control, I'm allowed to do so. What's worse, when I go to save the file (like when the application is executed or I'm running through TestManager), I'm told that the file is read-only and I'm asked if I want to overwrite it. Even if I overwrite the file, I still have to go to the Source Control Explorer and manually check the file out for editing. This is, as I'm sure many of you would agreed, annoying beyond belief. I could easily go on for paragraphs about how I'm being taken out of the flow and why isn't this happening automatically.

When I first discussed this problem with others, I was told to go to the Tools | Options dialog box. Once there, in the Source Control | Environment section, there is a couple of controls that control what happens to files upon Saving and Editing. It was suggested that setting these to “Check out automatically” would work.

Unfortunately, this wasn't the first. First off, it appears that these settings are the default values. At least, they were on my system. Frustration ensued for another couple of weeks.

Then, for reasons which I'm not sure of, some of the projects in my solution started acting the way they were supposed to. As I started editing a file, a quick “checking out” message appeared. I was confused, to put it mildly. Not to mention intrigued. As I started looking I found that the working projects contained a file with an extension of .vspscc. This is the source control bindings information for the project. After a little more work, I discovered how to create this file through the Visual Studio IDE. From the File menu, select Source Control | Change Source Control. In the dialog box that appears, the non-working projects will not be bound to a TFS server. Assuming that you are already connected to the correct TFS server, select the unbound projects and click on the Bind button at the top of the screen. This will check out the project files and you will (naturally) need to revolve any conflicts and check them back in. As well, you may need to restart Visual Studio to get the automatic check-out to work (I'm 50-50 on having to do this). But most importantly, source control will now work more like you would expect.