Why can't I reference System.Net.Sockets in a Portable Class Library using Xamarin?

前端 未结 2 1688
温柔的废话
温柔的废话 2021-01-02 15:13

I am trying to use System.Net.Sockets API in a portable class library so that my projects can reuse code for socket connections. But I cannot reference that namespace in my

2条回答
  •  天命终不由人
    2021-01-02 16:02

    As it is right now, there is no PCL profile targeting only

    • .NET Framework (4/4.03/4.5/4.5.1)
    • Xamarin.Android
    • Xamarin.iOS

    If you for example attempt to define a Portable Class Library with only these targets, the project PCL profile will automatically add the Silverlight 5 target:

    Silverlight 5 automatically added to PCL

    Even though Silverlight 5 itself does support some of the System.Net.Sockets namespace types, none of these types have been transferred to any PCL profile. As far as I can tell, the PCL System.Net functionality is limited to HTTP networking.

    For example, if .NET Framework 4.5 is selected, this will correspond to PCL profile 24, for which the System.Net.dll contents are as follows:

    enter image description here

提交回复
热议问题