Wil*_*ian 2 entity-framework .net-core windows-subsystem-for-linux ef-core-3.0
我一直在不同的操作系统(如Windows和Linux(Ubuntu) )中测试 dotnet core 3 。所有这些都可以与 EF Core 一起正常工作!
但是,我决定给Windows WSL - Linux 的 Windows 子系统一个机会,看看它是如何工作的。这就是为什么我在这里!
WSL 和 Ubuntu 18.04 的问题是:
我全局安装了 EF Core 并重新启动了终端。* 截至目前,EF 版本为 3.1.4
> dotnet tool install --global dotnet-ef
Run Code Online (Sandbox Code Playgroud)
当我尝试运行任何dotnet ef命令时出现以下错误:
> dotnet ef database update
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.
Run Code Online (Sandbox Code Playgroud)
有没有人在使用Windows WSL和Ubuntu 18.04 时遇到过同样的错误?
Wil*_*ian 12
终于我找到了解决方案!
我尝试导出 PATH 变量,export PATH="$PATH:$HOME/.dotnet/tools"如 @kapsiR 提到的。但是,它仅对单个终端会话有效。因此,如果我关闭终端并再次打开,$PATH 配置就会消失。
对我有用的解决方案:
cd /home/yourUserName.zshrc并添加此行export PATH="$PATH:$HOME/.dotnet/tools/"。注意:我zsh shell在这种情况下使用。如果您使用的是其他的,则应该更改它。遗憾的PATH是,安装dotnet-sdk.
你基本上有两个选择:
export PATH="$PATH:$HOME/.dotnet/tools" 或者
随着dotnet-sdk总会有一个脚本,它增加了PATH,它位于下/etc/profile.d/dotnet-cli-tools-bin-path.sh。
| 归档时间: |
|
| 查看次数: |
664 次 |
| 最近记录: |