locked
Problem with Background Task referencing a Portable Library using Microsoft.Net.Http (nuget) RRS feed

  • Question

  • Hello all,

    I'm working in a platform for some music apps and structuring it in:

    - PCL

    Radio.Core

    - WP7.5+

    Radio.Phone
    Radio.Phone.Sync

    - W8

    Radio.Windows
    Radio.Windows.Sync

    The problem is that Sync project doesn't build saying "Could not resolve reference 'Assembly(Name=System.Threading.Tasks, Version=1.5.11.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a)'" wich is added by "Microsoft.Net.Http" in "Radio.Core" project.

    Any suggestion?

    Thanks, Thiago

    Monday, January 13, 2014 12:55 PM

All replies

  • Can you point us to an app that reproduces the problem?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Monday, January 13, 2014 3:34 PM
    Moderator
  • To reproduce the problem follow the steps bellow:

    1. Create a Portable Class Library project called 'PortableClassLibrary1'

    2. Add these nuget references:

    a. Microsoft Async

    b. Microsoft BCL Build Components

    c. Microsoft BCL Portability Pack

    d. Microsoft Http Client Libraries

    3. Add the code below to the Class1:

    public async System.Threading.Tasks.Task Test()
            {
                using (var http = new System.Net.Http.HttpClient())
                {
                    var result = http.GetAsync("http://www.test.com");
                }
            }

    4.Create a Windows Runtime Component1 called 'WindowsRuntimeComponent1'

    5. Add a solution reference to 'PortableClassLibrary1'

    6. Add the code below to the Class1:

    public async void Print()
            {
                await new PortableClassLibrary1.Class1().Test();
            }

    Monday, January 13, 2014 7:33 PM
  • I followed these exact instructions, compiled and ran without issue.  Are you sure you have all of the correct references everywhere?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, January 14, 2014 4:35 PM
    Moderator