Add Service Reference not appearing

冷暖自知 提交于 2021-02-07 10:20:58

问题


In a Windows Phone 7 Silverlight project, I had a service reference to a WCF service. This morning when I opened up the project, suddenly the namespaces for my WCF service were unknown. The option for "Update Service Reference" in Solution Explorer was not there, so I deleted the Service Reference with the intent of re-adding it. But the option for "Add Service Reference" is also not there. Gone. Disappeared.

Closed and re-opened the solution. Restarted VS2010 Ultimate. No dice. Anyone run across this?


回答1:


I don't know how this happends in the first place, so we don't know the cause yet, but I found a solution to the problem.

Open your *.csproj file in Notepad or Textpad or something like that. Find where it has the tag. Replace that tag with this:

<ProjectTypeGuids>{14822709-B5A1-4724-98CA-57A101D1B079};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

Close and re-open the project and the option to add service references will be usable.




回答2:


I had the exact same problem with the missing "Add Service Reference" context menu option in Visual Studio 2017 with a regular C# desktop app project.

For me, the problem could be fixed by simply re-creating the entire project solution from scratch within Visual Studio. It turned out that the original project solution file had been created by an earlier version of Visual Studio, and this seems to have caused the problem.



来源:https://stackoverflow.com/questions/3196536/add-service-reference-not-appearing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!