Use System.Net.Sockets in PCL (.Net 4.5 + phone 8)

I have existing .Net libraries that already work for .Net 4.5 and Windows Phone 8. Now I would like to convert this to a portable class library, and suddenly I can no longer use it System.Net.Sockets.

I just tried .Net 4.5 and Windows Phone 8. The Xbox / store / silverlight application was not selected. Xamarin is automatically selected because it has the same requirements.

I can avoid sockets using interfaces and stuff, but why can't I use it if they both support it?

There are other stackoverflow questions about this, but they use xbox or metro applications.

+4
source share
1 answer

It seems the WinRT API has been added to PCL:

https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/4443287-make-winrt-api-usable-in-portable-class-libraries

Use WinRT API in portable class libraries oriented to Windows 8 and WP8

This is a great offer. We have added this feature for new versions of both platforms. Therefore, when you create a portable library class with the following goals (or any subset) that you have access to the WinRT API:

  • Windows 8.1
  • Windows Phone 8.1
  • Windows Phone Silverlight 8.1 For the first two platforms, you can also create Windows Runtime (WinMD) components.

Immo Landwerth
Program Manager
.NET Framework Team

VS2013.
:
http://blogs.msdn.com/b/somasegar/archive/2014/04/02/visual-studio-2013-update-2-rc-universal-projects-for-windows-and-windows-phone.aspx

WinRT Windows.Networking.Sockets:
http://msdn.microsoft.com/en-us/library/windows/apps/br226960.aspx

+1

Source: https://habr.com/ru/post/1529682/


All Articles