Mac, 运行dotnet ef报错

来源:1-2 【讨论题】对于不断推出的新框架,我们应该如何学习?

慕移动8056989

2023-06-15

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 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.
写回答

1回答

慕移动8056989

提问者

2023-06-15

网上找了帖子,说可能是因为dotnet-ef没装

dotnet tool install --global dotnet-ef


然后,又提示"/Users/[username]/.dotnet/tools"不在环境变量中,但是zsh给出了提示,运行一下代码

cat << \EOF >> ~/.zprofile

# Add .NET Core SDK tools

export PATH="$PATH:/Users/[username]/.dotnet/tools"

EOF


添加环境变量后,再运行dotnet ef,就显示可以用了

1
0

.Net 开发电商后端API 从0到精通RESTful

. Net 实战+RESTful思想纵深课程,开发优雅RESTful风格API。

977 学习 · 547 问题

查看课程