Search code examples
xamarin.formsxamarin.iosflurl

Xamarin.IOS Flurl.Http Reference Not Resolving


I am building a Xamarin.Forms application (.NETStandard 2.0) and one of my projects libraries used by Android, iOS, and UWP projects is using Flurl.Http.

- MySolution
| - My Android Project
| - My iOS Project
| - My UWP Project
| - Proj A lib
| - Proj B lib (this has added Flurl NuGet Dependency and it is used by all 3 head projects)
| - ...

Above, I added Flurl to Proj B library Dependencies/NuGet as required. After that, I am able to build my Android and UWP head projects just fine but my IOS project is failing to build with error:

MyApp.App.iOS/MTOUCH: Error MT2002: Failed to resolve
 "Flurl.Http.FlurlRequest" reference from "Flurl.Http, Version=2.3.2.0, 
Culture=neutral, PublicKeyToken=null" (MT2002) 

Solution

  • In case anyone runs into same issue, just r-c on your iOS head project Packages > Add Package and add Flurl.Http there, too.

    In the case above, I had it added only to the library project that my iOS proj is using and that resulted in error above.

    This solved my problem

    I am not sure why for iOS we have to add explicitly reference like this but doing this removed the issue for me.

    Now, both, the Proj B lib and iOS head project have dependency NuGet reference to Flurl like so

    - MySolution
    | - My Android Project
    | - My iOS Project (this also has package dependency on Flurl NuGet while Android and UWP do not need it)
    | - My UWP Project
    | - Proj A lib
    | - Proj B lib (this has Flurl NuGet Dependency and it is used by all 3 head projects)
    | - ...