Could not load file or assembly 'AWSSDK.Core On .net core in AWS Lambda

安稳与你 提交于 2019-12-12 12:35:44

问题


Using this template, I've been trying to get a Lambda function running. When it goes to execute a module containing

open Amazon
open Amazon.S3

it blows up with a

"errorType": "FileNotFoundException",

"errorMessage": "Could not load file or assembly 'AWSSDK.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=885c28607f98e604'. The system cannot find the file specified.",`

I've tried a nuget install of AWSSDK.Core to no avail.

Errors in /Users/sanitized/aws_lambda/project.json
    Package AWSSDK.Core 3.1.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0). Package AWSSDK.Core 3.1.0 supports:
      - monoandroid (MonoAndroid,Version=v0.0)
      - net35 (.NETFramework,Version=v3.5)
      - net45 (.NETFramework,Version=v4.5)
      - portable-net45+win8+wp8+wpa81 (.NETPortable,Version=v0.0,Profile=Profile259)
      - win8 (Windows,Version=v8.0)
      - wp8 (WindowsPhone,Version=v8.0)
      - wpa81 (WindowsPhoneApp,Version=v8.1)
      - xamarinios10 (Xamarin.iOS,Version=v1.0)
      - xamarinmac20 (Xamarin.Mac,Version=v2.0)
    One or more packages are incompatible with .NETCoreApp,Version=v1.0.

Here's the dependencies section of my project:

  "dependencies": {
    "Microsoft.FSharp.Core.netcore": "1.0.0-alpha-*",
    "Amazon.Core": "0.6.0",
    "Amazon.Lambda.Core": "1.0.0*",
    "Amazon.Lambda.Serialization.Json": "1.0.0",
    "Amazon.Lambda.Tools": {
      "type": "build",
      "version": "1.0.0-preview1"
    }
  },

The Lambda libraries seem to load correctly, but attempting to use an S3 client breaks. What're the .net-core blessed equivalents of AWSSDK.Core and AWSSDK.S3?


回答1:


As the error states:

Package AWSSDK.Core 3.1.0 is not compatible with netcoreapp1.0 (.NETCoreApp,Version=v1.0)

According to this link:

To use the the AWS sdk in ASP.NET Core based applications you 
need to use the 3.2.X versions of the NuGet packages. 
Note, they are currently marked as beta.


来源:https://stackoverflow.com/questions/41683460/could-not-load-file-or-assembly-awssdk-core-on-net-core-in-aws-lambda

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