I just spend 15 minutes frustrated at my computer because VSTS kept automatically checking my source into the wrong project. All the information on the Net said, “right click on the solution, click Add to Source Control, select the project you want to add it to, and voila, instant version control!” That’s just great, except that I wasn’t being given the option to check my code into a specific project; the source just flew somewhere out of my control. So I figured, hunt down the source files, delete them, try again. When I found out which project my source was being saved in and deleted the files, I found myself present with no source control options for my solution at all. After unbinding the files (see last paragraph), I was able to try to check them into source control again. Same problem occured once more.
It turns out that at some point in time my base directory (lets call it D:/) had managed to become mapped to this other VSTS project. Thus, any and all projects that resided somewhere on my D: drive which needed to be added to source control, would automatically go there. So if you’re trying to add to source control and files are being saved not in the project you expect, check for that condition first.
Under Source Control Explorer, select Workspaces… from the Workspace pulldown menu, then Edit -> Working Folders, select the one that lists the base directory under Local Folder, and hit Remove.
Another useful thing I stumbled across in my quest for the holy grail of source control… the Change Source Control button, home of the Unbind option. To reveal it, go to View -> Toolbars and select the Source Control – Team Foundation option. On the new toolbar that appears, the Change Source Control button is the yellow-gold one that vaguely looks like two cylinders on the left. When you open it up, it lists your active solution and projects, and presents you with the option to Unbind your source if it is currently resident in source control. You still have to manually delete the files that were previously checked into the wrong project though.