Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'dotnet lambda publish-layer' fails in .NET 6 with ‘--enable-package-optimization true’ #208

Open
Beau-Gosse-dev opened this issue Apr 11, 2022 · 5 comments
Labels
bug This issue is a bug. module/cli-ext needs-investigation p2 This is a standard priority issue queued

Comments

@Beau-Gosse-dev
Copy link
Contributor

Describe the bug

When trying to publish a .NET 6 layer, if you try to enable package optimizations, you will get an exception complaining about crossgen not existing in the tools directory of the .NET 6 SDK. It seems crossgen is no longer included with .NET 6 tools. And it sounds like this is by design according to this issue: dotnet/sdk#24752

Example command that throws the error:
dotnet lambda publish-layer dotnetsixlayer --layer-type runtime-package-store --s3-bucket my-layer-store-bucket --region us-east-1 --package-manifest ./layer-test-manifest.csproj --enable-package-optimization true --framework net6

Either removing the --enable-package-optimization true or downgrading to .NET 5 fixes the problem.

Expected Behavior

Publishes the layer to the store

Current Behavior

Amazon Lambda Tools for .NET Core applications (5.3.0)
Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet
	
Warning: Package optimization has been enabled. Be sure to run this on an Amazon Linux environment or the optimization might not be compatbile with the Lambda runtime.
Converted ASP.NET Core project file to temporary package manifest file.
... invoking 'dotnet store' for manifest /tmp/tmpzG6rga.tmp into output directory /tmp/dotnetsixlayer-637849539422701007/dotnetcore/store
... store: Microsoft (R) Build Engine version 17.1.0+ae57d105c for .NET
... store: Copyright (C) Microsoft Corporation. All rights reserved.
... store:   Determining projects to restore...
... store:   Restored /tmp/tmpzG6rga.tmp (in 377 ms).
... store: /usr/share/dotnet/sdk/6.0.201/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.CrossGen.targets(82,5): error NETSDK1016: Unable to find resolved path for '/home/ec2-user/.nuget/packages/microsoft.netcore.app.runtime.linux-x64/6.0.3/runtimes/linux-x64/native/../../../tools/crossgen'. [/tmp/tmpzG6rga.tmp]
Error executing the 'dotnet store' command

Reproduction Steps

On an AL2 VM, create a file layer-test-manifest.csproj with a NuGet reference in it, then run this command:
dotnet lambda publish-layer dotnetsixlayer --layer-type runtime-package-store --s3-bucket my-layer-store-bucket --region us-east-1 --package-manifest ./layer-test-manifest.csproj --enable-package-optimization true --framework net6

Possible Solution

This open issue mentions using FrameworkReferences

Additional Information/Context

No response

Targeted .NET platform

.NET 6

CLI extension version

Package Id Version Commands

amazon.lambda.testtool-3.1 0.12.1 dotnet-lambda-test-tool-3.1
amazon.lambda.testtool-5.0 0.12.0 dotnet-lambda-test-tool-5.0
amazon.lambda.testtool-6.0 0.12.1 dotnet-lambda-test-tool-6.0
amazon.lambda.tools 5.3.0 dotnet-lambda
nbgv 3.4.255 nbgv

Environment details (OS name and version, etc.)

Windows 10, Amazon Linux 2

@Beau-Gosse-dev Beau-Gosse-dev added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Apr 11, 2022
@ashishdhingra
Copy link
Contributor

Not sure if we need to remove package optimizations feature for .NET 6 (displaying proper error message) or to research more on FrameworkReferences described in dotnet/sdk#24752 (issue is awaiting response confirmation from the concerned team). Needs review.

@ashishdhingra ashishdhingra added needs-review investigating This issue is being investigated and/or work is in progress to resolve the issue. A and removed needs-triage This issue or PR still needs to be triaged. needs-review labels Apr 11, 2022
@Beau-Gosse-dev
Copy link
Contributor Author

@ashishdhingra it looks like Microsoft is removing support for dotnet store all together. Do we have a plan to keep functionality with .NET Lambda Layers some other way?

@ashishdhingra ashishdhingra added needs-investigation and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. labels Jul 11, 2022
@controdave
Copy link

Would love an answer to this please - is there any work around to publish a lambda layer :(

@Beau-Gosse-dev
Copy link
Contributor Author

@controdave There are 2 workarounds for publishing a layer still, do either of these help for now?

Either removing the --enable-package-optimization true or downgrading to .NET 5 fixes the problem.

@controdave
Copy link

@controdave There are 2 workarounds for publishing a layer still, do either of these help for now?

Either removing the --enable-package-optimization true or downgrading to .NET 5 fixes the problem.

Awe shucks, will there be a performance knock at all with remove package optimization? Thank you sir!

@ashishdhingra ashishdhingra added p2 This is a standard priority issue and removed A labels Nov 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. module/cli-ext needs-investigation p2 This is a standard priority issue queued
Projects
None yet
Development

No branches or pull requests

4 participants