.net 无法找到所需的库libhostfxr.so,Netcore Linux

nlejzf6q  于 2023-02-25  发布在  .NET
关注(0)|答案(2)|浏览(298)
❯ dotnet ef   
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/ru/.dotnet/tools/.store/dotnet-ef/6.0.2/dotnet-ef/6.0.2/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].

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

~

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

m528fe3b

m528fe3b1#

通过将其添加到髋臼杯轮廓的任何部分(可以在末端)解决:

# Netcore
export PATH=$PATH:$HOME/.dotnet/tools
export DOTNET_ROOT=$HOME/.dotnet
export PATH=$PATH:$DOTNET_ROOT

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

  • 哈希 shell :~/.bash配置文件、~/.bashrc
  • Korn shell :~/.kshrc或.profile
  • Z shell :~/.zshrc或. z配置文件
    不要忘记使用命令source ~/.bashrc(取决于您的shell配置文件),以便加载env变量。

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

❯ dotnet ef

                     _/\__       
               ---==/    \\      
         ___  ___   |.    \|\    
        | __|| __|  |  )   \\\   
        | _| | _|   \_/ |  //|\\ 
        |___||_|       /   \\\/\\

Entity Framework Core .NET Command-line Tools 6.0.2

Usage: dotnet ef [options] [command]

Options:
  --version        Show version information
  -h|--help        Show help information
  -v|--verbose     Show verbose output.
  --no-color       Don't colorize output.
  --prefix-output  Prefix output with level.

Commands:
  database    Commands to manage the database.
  dbcontext   Commands to manage DbContext types.
  migrations  Commands to manage migrations.

Use "dotnet ef [command] --help" for more information about a command.
mum43rcc

mum43rcc2#

我在使用Snap version时遇到了这个错误(还有很多其他错误)。当我切换到Snap version时,这些问题都消失了。

相关问题