Question

I am trying to add a Service Reference to my brand new console app and I am getting the following error:

Unable to check out the current file. The file may be read-only or locked, or you may need to check out the file manually.

Ref. http://msdn.microsoft.com/en-us/library/t3ec2ktk.aspx

I am not even connected to source control; this is a new project and I didn't check the "Include in source control" checkbox.

I have also tried making the entire project NOT read-only by right-clicking it and unchecking the Read Only box under Properties. However, the project's folder is still read-only... It won't change for some reason.

How can I add my service reference to my project?

Was it helpful?

Solution

The problem is; I was trying to add a Service Reference, but I should have actually tried adding a Web Reference. As per this page:

Its because you picked service reference, which generates a WCF based stub, which uses different classes and a different programming model. You need to make sure you're creating a web reference, not a service reference (unless you want to use the WCF based stuff), In VS.NET 2008, the web reference option IIRC, is hidden under the advanced button on the add service reference dialog.

Ref. http://boards.developerforce.com/t5/forums/forumtopicprintpage/board-id/general_development/message-id/33779/print-single-message/false/page/1

OTHER TIPS

Try to Run Visual Studio As Administrator. It seems like a problem in access to some directory.

The problem is a bug in Git source code provider. See here:

https://connect.microsoft.com/VisualStudio/feedback/details/789876/unable-to-add-web-service-when-using-git-source-code-provider

To workaround, turn it off when adding a service reference. Or check other workarounds in the above article. Still not fixed in VS 2013 Update4

I know this has been answered, but before trying everything else in the answers, restart visual studio. This just happened to me and 4 other people in my team. Seems to be a problem with visual studio 2013 and not 2012.

To me the solution was:
1)Removing the Service Reference then adding it again
2)In your web.config, you should check if adding the new reference adds another endpoint, if it does, you should remove one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top