I recently had a problem in which I could not add a new project to an existing solution which was bound to TFS source control. The only option I would get when I right-clicked on the new project was Source Control -> Add Solution to Source Control, which looked something like this:
I couldn't for the life of me figure out why it wouldn't let me check the project in, as it had before.
Until I noticed something:
Normally, when you have a file checked in to TFS, a little icon appears next to that file. Said icon could be a blue padlock (not checked out to you), a green plus (pending add), a red check (checked out to you), or various other symbols. But my solution file (.SLN) did not have any icon at all.
This told me that it wasn't checked in to TFS, which I knew was highly improbable since I had pulled this particular project to my machine from our TFS server a few weeks ago.
The actual problem was that the solution file had somehow become unbound from our source control server. This means that TFS no longer tracks the file, and cannot record any changes made to it. I still do not know how the solution file became unbound, but frankly I don't care; I just needed to add my new project to the solution.
A little bit of research later, I figured out how to fix this problem. In Visual Studio 2017, you can use File -> Source Control -> Advanced -> Change Source Control to open the Change Source Control dialog:
NOTE: The black bars are intentional.
Now, all you have to do is select the unbound solution file and click the Bind item from the top menu of the dialog. If Visual Studio can find the bindings (which, in my case, it could) then your solution will be rebound to TFS and you can add your project as your normally would.
Hello Dear Reader! Want to get the best C#, ASP.NET, web tech, tips, and stories anywhere on the Web? Sign up to receive my premium newsletter The Catch Block! Each Wednesday, you'll get the best reads, job listings, stories, tips, and news from around the ASP.NET and C# worlds. All for only $5/month or $50/year! Become a subscriber today!