首页 > 解决方案 > Rider AWS Lambda Hello World 项目错过了 libhostfxr.so

问题描述

全新的 Rider 向导生成的 AWS Lambda 项目在构建时失败:

dima@ubu:~/proj/HelloWorld2 $ dotnet --list-sdks
2.1.808 [/usr/share/dotnet/sdk]
3.1.302 [/usr/share/dotnet/sdk]
dima@ubu:~/proj/HelloWorld2 $ echo $DOTNET_ROOT
/usr/bin
dima@ubu:~/proj/HelloWorld2 $ which dotnet
/usr/bin/dotnet
dima@ubu:~/proj/HelloWorld2 $ sam build
Building function 'HelloWorldFunction'
Running DotnetCliPackageBuilder:GlobalToolInstall

Tool 'amazon.lambda.tools' was reinstalled with the latest stable version (version '4.0.0').
Running DotnetCliPackageBuilder:RunPackageAction


Build Failed
Error: DotnetCliPackageBuilder:RunPackageAction - Dotnet CLI Failed: A fatal error occurred. The required library libhostfxr.so could not be found.
If this is a self-contained application, that library should exist in [/home/dima/.dotnet/tools/.store/amazon.lambda.tools/4.0.0/amazon.lambda.tools/4.0.0/tools/netcoreapp2.1/any/].
If this is a framework-dependent application, install the runtime in the global location [/snap/bin] or use the DOTNET_ROOT environment variable to specify the runtime location or register the runtime location in [/etc/dotnet/install_location].

The .NET Core runtime can be found at:
  - https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=ubuntu.20.04-x64

dima@ubu:~/proj/HelloWorld2 $ find /usr/share/dotnet/host/fxr/ -name "*.so"
/usr/share/dotnet/host/fxr/2.1.20/libhostfxr.so
/usr/share/dotnet/host/fxr/3.1.6/libhostfxr.so
dima@ubu:~/proj/HelloWorld2 $ find /home/dima/.dotnet/tools/.store/amazon.lambda.tools/4.0.0/amazon.lambda.tools/4.0.0/tools/netcoreapp2.1/any/ -name "*.so"
dima@ubu:~/proj/HelloWorld2 $ 

更新:这是我创建项目的方式:

在此处输入图像描述

标签: ubuntu.net-coreaws-lambdarideraws-sam

解决方案


推荐阅读