Adding service reference to portable class library

后端 未结 5 1183
无人及你
无人及你 2021-01-04 03:45

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

Using VS 2013, I right click on the solution and in my other p

相关标签:
5条回答
  • 2021-01-04 04:07

    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)".

    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.

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

    0 讨论(0)
  • 2021-01-04 04:07

    I also got the same situation where the add service reference is missing from the context menu. The most voted answer pointed me to the right direction but I did not create another project. Just rename your packages.config first (maybe to .old). This should overcome the "The selected targets require the project to opt-into NuGet 3.0 support..." error when you uncheck Windows Phone from the targets.

    And yes it seems that removing Windows Phone target enables the add service reference context menu on your PCL project.

    0 讨论(0)
  • 2021-01-04 04:20

    The reason you can't add Service Reference in a Xamarin Forms PCL project can be:

    1. Windows Phone 8.1 (not Silverlight). Remove it by going to properties on PCL project and click Change. You might not be able to do it before you remove all your Nuget Packages.
    2. Visual Studio crashes when you add the service reference. Remove Xamarin Forms nuget package and Asp.net SignalR. That worked for me. I didn't have Entity Framework Core but that might have to be removed temporarily as well.
    0 讨论(0)
  • 2021-01-04 04:30

    I had this problem and I solve this going to Xamarin portable properties, Library, button Change (Targets) and I unchecked all Windows Phone Targets

    0 讨论(0)
  • 2021-01-04 04:31

    Add Reference "System.ServiceModel" and can you see "Service Reference"

    0 讨论(0)
提交回复
热议问题