Reputation: 572
I am on Ubuntu using VS Code to write an AWS lambda function and debugging it with the AWS Mock Lambda tool.
When I run 'dotnet --info' I see this:
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.32 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.32 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.14 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
I'm not sure why there are 2 folders, but it's creating a problem.
When I run VS Code, the project is dotnet 6.0, and it correctly finds that runtime in /usr/share/dotnet/shared/Microsoft.NETCore.App. I have reinstalled dotenet 6 several times using ./dotnet-install.sh and that is always where it is intstalled.
When I run it using the mock lambda tool, the code builds fine using the dotnet 6 runtime, but when the mock lambda tool tries to load, it throws this error:
The framework 'Microsoft.AspNetCore.App', version '6.0.0' was not found.
- The following frameworks were found:
3.1.32 at [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
So VS Code it getting the runtime from: /usr/share/dotnet/shared/Microsoft.NETCore.App (correct)
But AWS Mock Lambda is looking in: /usr/share/dotnet/shared/Microsoft.AspNetCore.App
If I remove the runtime from /usr/share/dotnet/shared/Microsoft.AspNetCore.App, it says it cannot find any runtimes.
Is there a way I can tell the lambda tool to look in the correct folder? Or install dotnet 6 in the folder the lambda tool is look for it in?
This is my launch.json in VS Code:
{
"version": "0.2.0",
"configurations": [
{
"name": "Job Worker",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "dotnet-lambda-test-tool-6.0",
"args": [],
"cwd": "${workspaceFolder}/JobWorker",
"console": "internalConsole",
"stopAtEntry": false
},
]
}
Upvotes: 0
Views: 106
Reputation: 63264
The description shows a common misconception about the runtimes.
There are indeed the .NET Core runtime Microsoft.NETCore.App
and the ASP.NET Core runtime Microsoft.AspNetCore.App
, so you should install ASP.NET Core 6 runtime to meet the requirement,
sudo apt-get install -y aspnetcore-runtime-6.0
https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu
Upvotes: 1