使用dotnet 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.
使用的命令为
dotnet ef database update
查看当前dot版本为3.0
解决办法:
需要更新dotnet tool,使用的命令为:
dotnet tool update --global dotnet-ef --version 3.0.0-preview7.19362.6
执行此命令之后再更新数据库就执行成功了。