Xamarin Forms IOS Failed to load assembly System.Net.Http.Primitive

五迷三道 提交于 2019-12-01 17:48:03

问题


I'm trying to do a release build for an IOS app using Xamarin.Forms in Visual Studio 2015.

Under the iOS Build menu in the properties of the app, If I set the Linker behaviour Link SDK assemblies only or Link all assemblies - I get the following build error:

Failed to resolve assembly: 'System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' BlackhawkPlatform.App.iOS

If I don't link any of the assemblies - the App builds fine but the output ipa is over 40mb big 0 uncompressed over 100mb and as such cannot be submitted to iTunes Connect.

I have the latest version installed of System.Net Client libraries and Xamarin Forms.

I have tried to skip the assembly link by using the command --linkskip=System.Net.Http.Primitives in the Additional mtouch argument box but that dos not work.

Any idea how I can get around this please?


回答1:


Found a solution which worked.

  1. In Nuget package manager install the latest version of Microsoft.BCL.Build v1.0.21
  2. then install the latest version of Microsoft.Net.Http v2.2.29

This worked for me.




回答2:


I know this is an old thread... but here is what I found missing in my ios.csproj file

<Reference Include="System.Net.Http.Extensions">
  <HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\Xamarin.iOS10\System.Net.Http.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http.Primitives">
  <HintPath>..\packages\Microsoft.Net.Http.2.2.29\lib\Xamarin.iOS10\System.Net.Http.Primitives.dll</HintPath>
</Reference>


来源:https://stackoverflow.com/questions/35926640/xamarin-forms-ios-failed-to-load-assembly-system-net-http-primitive

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!