0

I'm trying to create an AWS Lambda function in .NET Core 3.1 that uses EF Core.

I didn't know how to get EF Core working inside a Lambda function myself, so I resorted to using some code from this project.

When I try to test my Lambda function using the AWS .NET Core 3.1 Mock Lambda Test Tool, I get the following error on the console:

AWS .NET Core 3.1 Mock Lambda Test Tool (0.10.1)

Unknown error occurred causing process exit: Dependency resolution failed for component C:\Users\***\TestLambda\bin\Debug\netcoreapp3.1\TestLambda.dll with error code -2147450740. Detailed error: Error:

An assembly specified in the application dependencies manifest (TestLambda.deps.json) was not found:

    package: 'runtime.win-x64.runtime.native.System.Data.SqlClient.sni', version: '4.4.0'
    path: 'runtimes/win-x64/native/sni.dll'

    at System.Runtime.Loader.AssemblyDependencyResolver..ctor(String componentAssemblyPath)
    at Amazon.Lambda.TestTool.Runtime.LambdaAssemblyLoadContext..ctor(String lambdaPath) in C:\codebuild\tmp\output\src782171135\src\Tools\LambdaTestTool\src\Amazon.Lambda.TestTool\Runtime\LambdaAssemblyLoadContext.cs:line 28
    at Amazon.Lambda.TestTool.Runtime.LocalLambdaRuntime.Initialize(String directory, IAWSService awsService) in C:\codebuild\tmp\output\src782171135\src\Tools\LambdaTestTool\src\Amazon.Lambda.TestTool\Runtime\LocalLambdaRuntime.cs:line 71
    at Amazon.Lambda.TestTool.Runtime.LocalLambdaRuntime.Initialize(String directory) in C:\codebuild\tmp\output\src782171135\src\Tools\LambdaTestTool\src\Amazon.Lambda.TestTool\Runtime\LocalLambdaRuntime.cs:line 46
    at Amazon.Lambda.TestTool.TestToolStartup.Startup(String productName, Action`2 uiStartup, String[] args, RunConfiguration runConfiguration) in C:\codebuild\tmp\output\src782171135\src\Tools\LambdaTestTool\src\Amazon.Lambda.TestTool\TestToolStartup.cs:line 77

Press any key to exit

The strange thing is that I can't find any reference to System.Data.SqlClient 4.4.0 anywhere in the project. I even went through the solution trying to install that NuGet package in every project, but I'm still getting the same problem.

Any ideas?

user928112
  • 483
  • 1
  • 6
  • 24

1 Answers1

0

I fixed this problem by editing my csproj file to add the property CopyLocalLockFileAssemblies with a value of true.

For more details, see this thread: .NET Core 3.1 - Dependency resolution failed for component - AWS Mock Lambda Test Tools

user928112
  • 483
  • 1
  • 6
  • 24