找不到所需的库 libhostfxr.so。网核 Linux
The required library libhostfxr.so could not be found. Netcore Linux
❯ 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 不工作
在 运行 之后命令不起作用,我该怎么办?
通过在 shell 配置文件的任何部分添加这个解决(它可以在最后):
# Netcore
export PATH=$PATH:$HOME/.dotnet/tools
export DOTNET_ROOT=$HOME/.dotnet
export PATH=$PATH:$DOTNET_ROOT
您的 shell 个人资料可以在这些文件之一中:
- Bash Shell: ~/.bash_profile, ~/.bashrc
- Korn Shell: ~/.kshrc 或 .profile
- Z Shell: ~/.zshrc 或 .zprofile
不要忘记关闭再打开终端,这样环境变量就可以加载了。
检查是否一切正常 运行 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.
尝试更新以下配置并使用最新版本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"
我在使用 Snap version 时遇到了这个错误(以及许多其他错误)。
当我切换到 package manager version.
时,这些问题都消失了
❯ 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 不工作 在 运行 之后命令不起作用,我该怎么办?
通过在 shell 配置文件的任何部分添加这个解决(它可以在最后):
# Netcore
export PATH=$PATH:$HOME/.dotnet/tools
export DOTNET_ROOT=$HOME/.dotnet
export PATH=$PATH:$DOTNET_ROOT
您的 shell 个人资料可以在这些文件之一中:
- Bash Shell: ~/.bash_profile, ~/.bashrc
- Korn Shell: ~/.kshrc 或 .profile
- Z Shell: ~/.zshrc 或 .zprofile
不要忘记关闭再打开终端,这样环境变量就可以加载了。
检查是否一切正常 运行 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.
尝试更新以下配置并使用最新版本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"
我在使用 Snap version 时遇到了这个错误(以及许多其他错误)。 当我切换到 package manager version.
时,这些问题都消失了