I tried to add my solution to the local repository by selecting File|Add to Source Control, but I got the following message.
Delete .vs folder in the solution folder.
This solved it in my case. Reason for the problem in my case may have been that I had moved the whole Solution folder to another location (one level up). I assume some of the old paths were still lingering in the .vs cache. (Be sure to close Visual Studio before deleting this folder.)