将Amazon S3 Nuget包与Xamarin Android应用程序一起使用导致FileNotFoundException错误

4
当我将Amazon S3 Nuget包添加到我的Xamarin Android应用程序时,我遇到了以下错误:
Severity    Code    Description Project File    Line    Suppression State
Error       Exception while loading assemblies: System.IO.FileNotFoundException: Could not load assembly 'System.Net.Http.Primitives, Version=1.5.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Perhaps it doesn't exist in the Mono for Android profile?
File name: 'System.Net.Http.Primitives.dll'
   at Xamarin.Android.Tuner.DirectoryAssemblyResolver.Resolve(AssemblyNameReference reference, ReaderParameters parameters)
   at Xamarin.Android.Tasks.ResolveAssemblies.AddAssemblyReferences(ICollection`1 assemblies, AssemblyDefinition assembly, Boolean topLevel)
   at Xamarin.Android.Tasks.ResolveAssemblies.Execute() ContentUpdater  

有什么办法可以解决这个问题吗?

Nick。

更新:我刚试着在Windows 10通用应用程序上做了同样的操作,结果得到了这个:

Severity    Code    Description Project File    Line    Suppression State
Error       Cannot resolve Assembly or Windows Metadata file 'System.Net.Http.Primitives.dll'   WindowsContentUpdater   C:\devoctomy\GitHub\ContentUpdater\WindowsContentUpdater\WindowsContentUpdater.csproj   

S3库是破了还是怎么了?


从异常信息看,似乎您需要 Http Client 库。您可以试试这个问题上的指导吗?https://dev59.com/92Ml5IYBdhLWcg3we243#19411822 - Anthony Neace
我已经看过那个线程了,但不幸的是它没有帮助。我认为亚马逊SDK有问题,因为即使在添加引用后,它也无法与通用Windows 10应用程序一起使用,我会收到很多这样的警告... - Nick
严重程度 代码 描述 项目 文件 行 抑制状态 警告 检测到软件包降级:Microsoft.NETCore.UniversalWindowsPlatform从5.2.2到5.1.0 WindowsContentUpdaterObjectLibrary(>= 1.0.0)-> AWSSDK.S3(>= 3.3.3)-> Microsoft.NETCore.UniversalWindowsPlatform(>= 5.2.2) WindowsContentUpdaterObjectLibrary(>= 1.0.0)-> Microsoft.NETCore.UniversalWindowsPlatform(>= 5.1.0) 0 - Nick
目前我决定从一个Windows Forms应用程序和一个标准的.NET类库开始,当我把它们搞定后,我会将我的代码移植到一个可移植库中。我怀疑AWS S3库需要更新,也许? - Nick
我发现了 Kvandike 写的一个小型库叫做 BasicAWS,编译很顺利,可能是现在的解决方案。 - Nick
你碰到了同样的问题,我猜你没有什么更好的运气处理这个问题了? - santaaimonce
1个回答

2

有点晚了,但我还是解决了它。

  1. 卸载所有的AWSSDK nugets
  2. 首先添加Microsoft.Net.Http nuget
  3. 添加AWSSDK.Core、S3,然后再添加Cognito和其他你需要的内容

谢谢,直接添加Microsoft.Net.Http NuGet就足以解决我的问题了! - bnu

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接