I’ve received the following error message in Visual Studio right after I’ve tried to add a new service reference:
Unable to check out the current file. The file may be read-only or locked, or you may need to check the file out manually.
The message was really strange because the Add Service Reference dialog seemed to recognize the service perfectly, and although the project was under source control, we have Git on the server so “check out” did not seem to be the right term here.
The sad truth is that the above error message is completely wrong and the issue has nothing to do with source control. The solution is to click the Advanced button in the Add Service Reference dialog, then click the Add Web Reference button and use the old Add Web Reference dialog to add that particular service to your project even if the URL points to a .svc file.