Frage

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.

War es hilfreich?

Lösung

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

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top