使用AWS re:Post即您表示您同意 AWS re:Post 使用条款

Creating a zip file for my Lambda

0

Hello! I wanted to ask if you could provide some insights into an error I am running into when I run the command line below to create a zip file for my lambda?

Command line: dotnet lambda package --configuration release --framework net6.0 --output-package releases/test.zip

Error: The type or namespace DynamoDBv2 does not exist in the Namespace 'Amazon' (are you missing an assembly reference)?

I am following the steps from the documentation linked: https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/CodeSamples.DotNet.html

I have installed the NuGet pkg: AWSSDK.DynamoDBv2 (3.7.301.20) numerous times, and each time I run the command line after, then I get the error and my NuGet pkg is still there but there is now a warning icon over it.

I've ran the command line before in the past with other AWS resources like SQS, so I am not sure why the error is occurring.

已提问 9 个月前397 查看次数
2 回答
1

Hello, I will try that and provide an update.

已回答 9 个月前
0

Is the AWSSDK.DynamoDBv2 package is installed in the Lambda project itself? It's important that the package is referenced directly by the project being packaged. If it's only included in a dependent project, ensure that the dependencies are correctly being resolved. Try to open your Lambda function's .csproj file to verify that the AWSSDK.DynamoDBv2 package reference exists:

<ItemGroup>
  <PackageReference Include="AWSSDK.DynamoDBv2" Version="3.7.301.22" />
</ItemGroup>

If it's missing, add it manually or re-install the package using the command line:

dotnet add package AWSSDK.DynamoDBv2 --version 3.7.301.22

Before running the dotnet lambda package command, make sure all NuGet packages are restored properly to resolve any missing dependencies:

dotnet restore

References:

profile picture
专家
已回答 9 个月前
profile picture
专家
已审核 8 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则