找不到所需的库 libhostfxr.so。网络核心Linux

Raú*_*ate 4 .net entity-framework-core .net-core asp.net-core

 \xe2\x9d\xaf dotnet ef   \nA fatal error occurred. The required library libhostfxr.so could not be found.\nIf this is a self-contained application, that library should exist in [/home/ru/.dotnet/tools/.store/dotnet-ef/6.0.2/dotnet-ef/6.0.2/tools/netcoreapp3.1/any/].\nIf 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].\n\nThe .NET runtime can be found at:\n  - https://aka.ms/dotnet-core-applaunch?missing_runtime=true&arch=x64&rid=arch-x64&apphost_version=6.0.2\n\n~ \n
Run Code Online (Sandbox Code Playgroud)\n

dotnet ef 不起作用\n运行命令后不起作用,我该怎么办?

\n

Raú*_*ate 8

通过将其添加到 shell 配置文件的任何部分(可以在末尾)来解决:

\n
# Netcore\nexport PATH=$PATH:$HOME/.dotnet/tools\nexport DOTNET_ROOT=$HOME/.dotnet\nexport PATH=$PATH:$DOTNET_ROOT\n
Run Code Online (Sandbox Code Playgroud)\n

您的 shell 配置文件可以位于以下文件之一:

\n
    \n
  • Bash 外壳:~/.bash_profile、~/.bashrc
  • \n
  • Korn Shell:~/.kshrc 或 .profile
  • \n
  • Z Shell:~/.zshrc 或 .zprofile
  • \n
\n

不要忘记使用命令source ~/.bashrc(取决于您的 shell 配置文件),以便可以加载环境变量。

\n

更多这里

\n

要检查一切是否正常,请运行dotnet ef,您应该得到如下结果:

\n
\xe2\x9d\xaf dotnet ef\n\n                     _/\\__       \n               ---==/    \\\\      \n         ___  ___   |.    \\|\\    \n        | __|| __|  |  )   \\\\\\   \n        | _| | _|   \\_/ |  //|\\\\ \n        |___||_|       /   \\\\\\/\\\\\n\nEntity Framework Core .NET Command-line Tools 6.0.2\n\nUsage: dotnet ef [options] [command]\n\nOptions:\n  --version        Show version information\n  -h|--help        Show help information\n  -v|--verbose     Show verbose output.\n  --no-color       Don\'t colorize output.\n  --prefix-output  Prefix output with level.\n\nCommands:\n  database    Commands to manage the database.\n  dbcontext   Commands to manage DbContext types.\n  migrations  Commands to manage migrations.\n\nUse "dotnet ef [command] --help" for more information about a command.\n
Run Code Online (Sandbox Code Playgroud)\n