[英]How to properly install dotnet ef on Ubuntu?
我正在尝试在Ubuntu 20.4.1 LTS
上安装dot.net ef 。
首先,我在全球范围内安装了该工具:
do.net tool install --global do.net-ef
因为它不起作用,所以我将此 PATH 引用添加到我的.bashrc
文件上的 do.net 工具文件夹:
export PATH="$PATH:$HOME/.do.net/tools/"
正如这里所建议的: Cannot find command 'do.net ef'?
然而,当我尝试运行do.net ef
时,我收到以下错误消息:
Could not execute because the specified command or file was not found.
Possible reasons for this include:
* You misspelled a built-in dotnet command.
* You intended to execute a .NET Core program, but dotnet-ef does not exist.
* You intended to run a global tool, but a dotnet-prefixed executable with this name could not be found on the PATH.
有趣的是,如果我尝试再次安装它,我会被告知它已经安装好了。
Tool 'dotnet-ef' is already installed.
但是如果我尝试使用do.net tool list
列出我安装的工具,我会得到一个空的结果:
Tool 'dotnet-ef' is already installed.
我还检查了我的~/.do.net/tools/
文件夹,它是空的。
我在这里错过了什么?
找到了解决方案。
将以下内容添加到.bashrc/.zshrc
export PATH="$PATH:$HOME/.dotnet/tools/"
我在 Ubuntu 上遇到了同样的问题。 我已经手动安装了 dotnet。 出于某种原因,dotnet-ef 在“/usr/share/dotnet”中查找 dotnet。 所以我必须将 dotnet-sdk 安装在目录“/usr/share/dotnet”中,相应地更改 PATH 并将 DOTNET_ROOT 设置为该目录。 然后 dotnet-ef 也起作用了。
顺便说一句:如果 --global 不起作用,您可以通过 --tool-path "$HOME/.dotnet/tools" 手动设置 dotnet-ef 的安装路径。
使用 Fish 时,在全局安装 ef 后使用fish_add_path $HOME/.do.net/tools/
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.