使用异步CTP与便携式类库 [英] Using Async CTP with Portable Class Library

查看:164
本文介绍了使用异步CTP与便携式类库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图重写一个项目分成便携式类库。但问题是,它是采用异步CTP,我不能编译它为WP和Windows Store应用库。如果我不包括参考AsyncCtpLibrary.dll,编译器说,

I am trying to rewrite a project into a Portable Class Library. But the problem is that it is using Async CTP, and I can't compile it as a library for WP and Windows Store App. If I don't include reference AsyncCtpLibrary.dll, compiler says that

类型或命名空间名称'任务'不存在命名空间'的System.Threading存在(是否缺少程序集引用?)

The type or namespace name 'Tasks' does not exist in the namespace 'System.Threading' (are you missing an assembly reference?)

如果我有它,编译器仍然说了同样的错误,并增加了一个警告:

If i include it, compiler still says the same errors and adds a warning:

主要参考AsyncCtpLibrary无法得到解决,因为它的框架组件的间接依赖mscorlib程序,版本= 4.0.0.0,文化=中性公钥= b77a5c561934e089,它无法在当前的目标框架内解决。 .NETPortable,版本V4.0 =,外形= Profile104。要解决此问题,要么删除参考AsyncCtpLibrary或重新定位你的应用程序,其中包含一个框架版mscorlib程序,版本= 4.0.0.0,文化=中性公钥= b77a5c561934e089。

The primary reference "AsyncCtpLibrary" could not be resolved because it has an indirect dependency on the framework assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" which could not be resolved in the currently targeted framework. ".NETPortable,Version=v4.0,Profile=Profile104". To resolve this problem, either remove the reference "AsyncCtpLibrary" or retarget your application to a framework version which contains "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".

我应该如何承担与?

推荐答案

答案很简单 - AsyncCTP没有在Visual Studio 2012中工作,不能在任何项目中使用。对于.NET 4.0和Silverlight 5,你可以安装从异步那的NuGet以类似的方式工作靶向包。结果
异步/等待是可移植类库针对WinRT的,.NET4.5或Windows Phone 8时,即使这样的用途是pretty限制仅支持。我不能进入更多的细节在这里,因为在Windows Phone 8 SDK仍然是保密协议。结果
对于WP7.5和VS2012目前还没有办法如何使用异步/的await,但异步更新包瞄准这个平台应该提供的某个时候。结果
还需要注意的是AsyncCTP和异步靶向包不能在便携式类库使用,它不太可能会改变未来。其结果是在VS2010不能使用便携式类库异步/游览车。

Simple answer - AsyncCTP is not working in Visual Studio 2012 and cannot be used in any project. For .NET 4.0 and Silverlight 5 you can install Async Targeting Pack from NuGet that works in a similar fashion.
Async/await is in Portable Class Library supported only when targeting WinRT, .NET4.5 or Windows Phone 8 and even then the use is pretty limited. I can't go into more details here, because the Windows Phone 8 SDK is still under NDA.
For WP7.5 and VS2012 there is currently no way how to use async/await, but updated Async Targeting Pack for this platform should be available sometime.
Note also that AsyncCTP and Async Targeting Pack can't be used in Portable Class Libraries and it's unlikely it will change in the future. The result is in VS2010 you cannot use async/await in Portable Class Libraries.

这篇关于使用异步CTP与便携式类库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆