Still getting this error in 2025. For me I just closed the solution, deleted the .vs file in the solution folder, then reopened the solution and after that I was able to add the solution and its projects to source control.