4

I have existing .Net libraries which work already for .Net 4.5 and Windows Phone 8. Now I would like to convert this in a portable class library and suddenly I can't use System.Net.Sockets anymore.

I only cheched .Net 4.5 and windows phone 8. Xbox/store app/silverlight is not selected. Xamarin is automaticly selected because it has the same requirements.

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

There are other questions on stackoverflow about this but these use xbox or metro apps.

Christian Phillips
  • 18,399
  • 8
  • 53
  • 82
roeland
  • 6,058
  • 7
  • 50
  • 67
  • A while back I gave an answer to a similar question, please have a look [here](http://stackoverflow.com/a/21368529/650012) for a suggestion on what you could do. – Anders Gustafsson Mar 02 '14 at 21:33

1 Answers1

1

It seems the WinRT API is added to PCL:

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

Make WinRT API usable in Portable Class Libraries targeting Windows 8 and WP8

That’s a great suggestion. We’ve added this capability for the new versions of both platforms. So when you author a portable class libraries with the following targets (or any subset) you’ll have access to WinRT APIs as well:

  • Windows 8.1
  • Windows Phone 8.1
  • Windows Phone Silverlight 8.1 For the first two platforms, you’re also able to produce Windows Runtime components (WinMD).

Immo Landwerth
Program Manager
.NET Framework Team

You need VS2013 Update 2 for this.
Here some more info about this update:
http://blogs.msdn.com/b/somasegar/archive/2014/04/02/visual-studio-2013-update-2-rc-universal-projects-for-windows-and-windows-phone.aspx

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

Community
  • 1
  • 1
roeland
  • 6,058
  • 7
  • 50
  • 67