Search code examples
c#asynchronousportable-class-librarywinrt-async

Not able to return async await in Portable Class Library


I have a portable class library which has a method returning Task<string>. When I try to use it in a Windows Store WinRT component, I get following error within WinRT component.

Error 77 Could not resolve reference 'Assembly(Name=System.Threading.Tasks, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)'.

Please note that the portable class library builds fine independently. The portable class library targets following framework:

  • .NET Framework 4.5
  • Silverlight 4 and higher
  • Windows Phone 8
  • .NET for Windows Store apps

Is this even possible?


Solution

  • Microsoft BCL team accepted this as a known issue and workaround for this issue is now documented at:

    http://blogs.msdn.com/b/bclteam/p/asynctargetingpackkb.aspx#issue7

    And not to mention, it is working fine now with this workaround :)