question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

5.6.0 dotnet lambda package does not copy all files from publish folder

See original GitHub issue

Describe the bug

When running dotnet lambda package, the zip stage skips the PDB file. This breaks local debugging for SAM applications.

I’ve confirmed the previous behavior in 5.5.0 (see repro steps) was to copy the PDB file.

Expected Behavior

The PDB file to be copied into the zip.

Current Behavior

PDB file was not copied.

Reproduction Steps

radicaledward@work-panzer  ~/test/dotnettest  dotnet new console
The template "Console App" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /home/radicaledward/test/dotnettest/dotnettest.csproj...
  Determining projects to restore...
  Restored /home/radicaledward/test/dotnettest/dotnettest.csproj (in 62 ms).
Restore succeeded.


 radicaledward@work-panzer  ~/test/dotnettest  dotnet lambda package
Amazon Lambda Tools for .NET Core applications (5.6.0)
Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet

Executing publish command
... invoking 'dotnet publish', working folder '/home/radicaledward/test/dotnettest/bin/Release/net6.0/publish'
... dotnet publish "/home/radicaledward/test/dotnettest" --output "/home/radicaledward/test/dotnettest/bin/Release/net6.0/publish" --configuration "Release" --framework "net6.0" /p:GenerateRuntimeConfigurationFiles=true --runtime linux-x64 --self-contained False
... publish: Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
... publish: Copyright (C) Microsoft Corporation. All rights reserved.
... publish:   Determining projects to restore...
... publish:   Restored /home/radicaledward/test/dotnettest/dotnettest.csproj (in 92 ms).
... publish:   dotnettest -> /home/radicaledward/test/dotnettest/bin/Release/net6.0/linux-x64/dotnettest.dll
... publish:   dotnettest -> /home/radicaledward/test/dotnettest/bin/Release/net6.0/publish/
Changed permissions on published file (chmod +rx dotnettest).
Changed permissions on published file (chmod +rx dotnettest.pdb).
Changed permissions on published file (chmod +rx dotnettest.dll).
Changed permissions on published file (chmod +rx dotnettest.runtimeconfig.json).
Changed permissions on published file (chmod +rx dotnettest.deps.json).
Zipping publish folder /home/radicaledward/test/dotnettest/bin/Release/net6.0/publish to /home/radicaledward/test/dotnettest/bin/Release/net6.0/dotnettest.zip
... zipping:   adding: dotnettest (deflated 63%)
... zipping:   adding: dotnettest.dll (deflated 59%)
... zipping:   adding: dotnettest.runtimeconfig.json (deflated 32%)
... zipping:   adding: dotnettest.deps.json (deflated 54%)
Created publish archive (/home/radicaledward/test/dotnettest/bin/Release/net6.0/dotnettest.zip).
Lambda project successfully packaged: /home/radicaledward/test/dotnettest/bin/Release/net6.0/dotnettest.zip

Note that this works fine on 5.5.0:

radicaledward@work-panzer  ~/test/dotnettest  dotnet tool uninstall --global Amazon.Lambda.Tools
Tool 'amazon.lambda.tools' (version '5.6.0') was successfully uninstalled.
 radicaledward@work-panzer  ~/test/dotnettest  dotnet tool install --global Amazon.Lambda.Tools --version 5.5.0
You can invoke the tool using the following command: dotnet-lambda
Tool 'amazon.lambda.tools' (version '5.5.0') was successfully installed.
 radicaledward@work-panzer  ~/test/dotnettest  dotnet lambda package
Amazon Lambda Tools for .NET Core applications (5.5.0)
Project Home: https://github.com/aws/aws-extensions-for-dotnet-cli, https://github.com/aws/aws-lambda-dotnet

Executing publish command
Deleted previous publish folder
... invoking 'dotnet publish', working folder '/home/radicaledward/test/dotnettest/bin/Release/net6.0/publish'
... dotnet publish --output "/home/radicaledward/test/dotnettest/bin/Release/net6.0/publish" --configuration "Release" --framework "net6.0" /p:GenerateRuntimeConfigurationFiles=true --runtime linux-x64 --self-contained false
... publish: Microsoft (R) Build Engine version 17.2.0+41abc5629 for .NET
... publish: Copyright (C) Microsoft Corporation. All rights reserved.
... publish:   Determining projects to restore...
... publish:   All projects are up-to-date for restore.
... publish:   dotnettest -> /home/radicaledward/test/dotnettest/bin/Release/net6.0/linux-x64/dotnettest.dll
... publish:   dotnettest -> /home/radicaledward/test/dotnettest/bin/Release/net6.0/publish/
Changed permissions on published file (chmod +rx dotnettest).
Changed permissions on published file (chmod +rx dotnettest.pdb).
Changed permissions on published file (chmod +rx dotnettest.dll).
Changed permissions on published file (chmod +rx dotnettest.runtimeconfig.json).
Changed permissions on published file (chmod +rx dotnettest.deps.json).
Zipping publish folder /home/radicaledward/test/dotnettest/bin/Release/net6.0/publish to /home/radicaledward/test/dotnettest/bin/Release/net6.0/dotnettest.zip
... zipping:   adding: dotnettest (deflated 63%)
... zipping:   adding: dotnettest.pdb (deflated 42%)
... zipping:   adding: dotnettest.dll (deflated 59%)
... zipping:   adding: dotnettest.runtimeconfig.json (deflated 32%)
... zipping:   adding: dotnettest.deps.json (deflated 54%)
Created publish archive (/home/radicaledward/test/dotnettest/bin/Release/net6.0/dotnettest.zip).
Lambda project successfully packaged: /home/radicaledward/test/dotnettest/bin/Release/net6.0/dotnettest.zip

Possible Solution

No response

Additional Information/Context

No response

Targeted .NET platform

6.0.302

CLI extension version

Package Id               Version         Commands
------------------------------------------------------
amazon.lambda.tools      5.6.0           dotnet-lambda
dotnet-ef                6.0.4           dotnet-ef
dotnet-symbol            1.0.212301      dotnet-symbol

Environment details (OS name and version, etc.)

WSL ubuntu

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
normjcommented, Nov 8, 2022

The code is in the pipeline for release, so unless something unusual happens the fix should be out within the next couple hours.

Only work around till then I can think of is if you pull 5.5.0 into a local folder and set the folder up as a NuGet feed. Then put a nuget.config file that only has the local feed.

0reactions
github-actions[bot]commented, Nov 10, 2022

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SAM build continually updates Lambda Tools · Issue #347
5.6.0 dotnet lambda package does not copy all files from publish folder aws/aws-extensions-for-dotnet-cli#248.
Read more >
asp.net core - dotnet publish won't copy files with copy task
For running Target in FolderProfile.pubxml , try to specify the conditions like BeforeTargets or AfterTargets .
Read more >
Deploying an AWS Lambda Project with the .NET Core CLI
NET Core CLI to deploy AWS Lambda functions. ... You can deploy Lambda functions built in Visual Studio using the .NET Core command...
Read more >
How do I build a Lambda deployment package for C# .NET?
To resolve the issue, you must build a C# Lambda function deployment package that has the correct folder structure. There are two ways...
Read more >
Dotnet fails to install tools - Microsoft Q&A
I cannot install the AWS Lambda tools in dotnet: Copy. $ dotnet tool install -g Amazon.Lambda.Tools error NU1100: Unable to resolve ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found