Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install dotnet ef success but when call it hit error

Tags:

.net-core

Error: 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/alanee/.dotnet/tools/.store/dotnet-ef/3.1.3/dotnet-ef/3.1.3/tools/netcoreapp3.1/any/]. If this is a framework-dependent application, install the runtime in the global location [/usr/share/dotnet] 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

My current dotnet info is: .NET Core SDK (reflecting any global.json): Version: 3.1.201 Commit: b1768b4ae7

Runtime Environment: OS Name: ubuntu OS Version: 20.04 OS Platform: Linux RID: linux-x64 Base Path: /snap/dotnet-sdk/69/sdk/3.1.201/

Host (useful for support): Version: 3.1.3 Commit: 4a9f85e9f8

.NET Core SDKs installed: 3.1.201 [/snap/dotnet-sdk/69/sdk]

.NET Core runtimes installed: Microsoft.AspNetCore.App 3.1.3 [/snap/dotnet-sdk/69/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 3.1.3 [/snap/dotnet-sdk/69/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs: https://aka.ms/dotnet-download

like image 338
alanee Avatar asked Oct 20 '25 02:10

alanee


1 Answers

make the configuration below and use the latest version of dotnet-ef:

export PATH="$PATH:$HOME/.dotnet/tools"
export DOTNET_ROOT=/snap/dotnet-sdk/current
export MSBuildSDKsPath=$DOTNET_ROOT/sdk/$(${DOTNET_ROOT}/dotnet --version)/Sdks
export PATH="${PATH}:${DOTNET_ROOT}"
export PATH="$PATH:$HOME/.dotnet/tools"
like image 141
Nomair Ghanem Avatar answered Oct 21 '25 19:10

Nomair Ghanem