将服务引用添加到可移植类库 [英] Adding service reference to portable class library

查看:93
本文介绍了将服务引用添加到可移植类库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个可移植的C#类库,并尝试向我的项目添加Web服务引用.

I am making a portable C# class library and I am trying to add a web service reference to my project.

使用VS 2013,我右键单击该解决方案,在我的其他项目中,将有一个添加服务引用"选项.但是在我的移动图书馆项目中,该选项不存在.

Using VS 2013, I right click on the solution and in my other projects there would be an option to "Add service reference." But in my mobile library project that option does not exist.

向移动图书馆添加服务引用是否需要做一些特别的事情?

Is there something special one needs to do to add a service reference to a mobile library or is it not possible?

请参阅屏幕截图,甚至没有选择向我的项目添加服务引用.

See screenshot, there isn't even an option to add a service reference to my project.

推荐答案

我遇到了同样的问题.在Visual Studio中创建空白应用程序(Xamarin.Forms共享)"类型的新项目后,右键单击PCL时没有添加服务引用"链接.我所做的是我创建了另一个PCL并引用了它的默认值之一(稍后将其删除). 我选择了类库(可移植到iOS,Android和Windows)"类型的项目.

I was having the same problem. Right after creation of a new project of type "Blank App (Xamarin.Forms Shared) in Visual Studio there was no "Add Service Reference" link when I right clicked on PCL. What I did was I just created another PCL and referenced it instead of default one (which I deleted later). I chose project of type "Class Library (Portable for iOS, Android and Windows)".

然后我转到项目的属性,并取消选中"Windows Phone 8.1"复选框.

And then I went to project's properties and unselected "Windows Phone 8.1" checkbox.

添加服务参考"链接突然出现.

And "Add Service Reference" link appeared all over the sudden.

我正在使用Visual Stuido 2015 Community Edition(版本14.0.25123.00更新2).希望这也对你们有用.

I am using Visual Stuido 2015 Community Edition (version 14.0.25123.00 Update 2). Hope this will work for you guys too.

这篇关于将服务引用添加到可移植类库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆