问题描述
我有已经工作的.Net 4.5和Windows Phone 8的现有的.NET库。现在我想将其转换在便携式类库,突然我不能使用的System.Net.Sockets
了。
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.
我只cheched的.Net 4.5和Windows Phone 8的Xbox /存储应用程序/ Silverlight是没有选择。Xamarin是全自动选择,因为它具有相同的要求。
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?
有其他问题上的计算器关于这一点,但这些使用的Xbox或地铁的应用程序。
There are other questions on stackoverflow about this but these use xbox or metro apps.
推荐答案
看来WinRT的API将被添加到PCL:
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
制作的WinRT API可用在针对Windows 8和WP8便携式类库
这是一个很好的建议。我们增加了这个功能新 这两个平台的版本。所以,当你编写一个便携类 用下面的目标(或子集),你就会有库 获得的WinRT API的还有:
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对于前两个平台,你还能够生产Windows运行时组件(WinMD)。
- 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
项目经理
.NET框架团队
Immo Landwerth
Program Manager
.NET Framework Team
您需要在此VS2013更新2。照片这里是一些有关此更新的详细信息:
http://blogs.msdn.com/b/somasegar/archive/2014/04/02/visual-studio-2013-update-2-rc-universal-projects-for-windows-and-windows-phone.aspx
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
在WinRT的套接字是在 Windows.Networking.Sockets
命名空间:
http://msdn.microsoft.com/en-us/library /windows/apps/br226960.aspx
Sockets in WinRT is in the Windows.Networking.Sockets
namespace:
http://msdn.microsoft.com/en-us/library/windows/apps/br226960.aspx
这篇关于使用的System.Net.Sockets在PCL(.NET 4.5 +电话8)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!