Aws-lambda-dotnet: Error on deploy when referencing a .NET Standard library

Created on 2 Sep 2017  路  5Comments  路  Source: aws/aws-lambda-dotnet

I recently discovered that if I add a reference to a project targeting .NET Standard 1.4 to my serverless project, I get the following error on dotnet lambda deploy-serverless:

Error: Project is referencing NETStandard.Library version 1.6.1. Max version supported by netcoreapp1.0 is 1.6.0.
Error: NETStandard.Library 1.6.1 is used for target framework netcoreapp1.1.
Error: Check the following dependencies for versions compatible with netcoreapp1.0:
Error:  amazon.lambda.apigatewayevents : 1.1.0
Error:  amazon.lambda.serialization.json : 1.1.0
Error:  testclasslibrary : 1.0.0

To reproduce. From Visual Studio 2017 (latest updates installed):

  • File -> New Project
  • Select AWS Serverless Application (.NET Core)
  • Pick anything for the blueprint. I chose the blog API
  • From project directory

    • dotnet restore

    • dotnet build

    • dotnet lambda deploy-serverless

  • Observe that deployment works
  • Right click on solution in VS. Add .NET standard class library
  • Change targeting of library to .NET Standard 1.4
  • In Solution Explorer, right click on Dependencies under serverless app
  • Add a project reference to the class library
  • File -> Save All
  • From project directory

    • dotnet restore

    • dotnet build

    • dotnet lambda deploy-serverless

  • Observe that deployment fails
guidance

Most helpful comment

In your csproj file for the class library can add the following as a sibling to the TargetFramework to force the implicit reference of NETStandard.Library to be 1.6.0.

<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>

All 5 comments

Incidentally, this appears to happen regardless of which version of .NET Standard you target in the class library.

In your csproj file for the class library can add the following as a sibling to the TargetFramework to force the implicit reference of NETStandard.Library to be 1.6.0.

<NetStandardImplicitPackageVersion>1.6.0</NetStandardImplicitPackageVersion>

Closing as I believe my last comment should unblock you. If not feel free to reopen.

That did the trick. Thanks.

thanks @normj - that tag did the trick!

Was this page helpful?
0 / 5 - 0 ratings