代码之家  ›  专栏  ›  技术社区  ›  pixel

xamarin.ios flurl.http引用未解析

  •  1
  • pixel  · 技术社区  · 7 年前

    我正在构建一个xamarin.forms应用程序(.netstandard 2.0),android、ios和uwp项目使用的一个项目库正在使用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)
    | - ...
    

    上面,我根据需要向项目B库依赖项/nuget添加了flurl。之后,我可以构建我的android和uwp head项目,但我的iOS项目未能构建,错误如下:

    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) 
    
    1 回复  |  直到 7 年前
        1
  •  1
  •   pixel    7 年前

    如果有人遇到同样的问题,只需在iOS的头项目包上添加r-c,然后在那里添加flurl.http。

    在上面的例子中,我只将它添加到了我的iOS项目正在使用的库项目中,这导致了上面的错误。

    这解决了我的问题

    我不知道为什么要为iOS添加这样的明确引用,但这样做消除了我的问题。

    现在,项目b lib和ios head项目都有类似flurl的依赖nuget引用

    - 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)
    | - ...