Sig*_*gGP 6 entity-framework docker entity-framework-migrations asp.net-core-3.1
我正在尝试在 docker 上运行用 asp.net core 3.1 编写的应用程序。我需要使用迁移创建数据库。执行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)
据我了解,我需要安装 dotnet-ef 工具。在容器中执行此操作的正确方法是什么?
就像 @harili 所说,您必须安装它并将其添加到 PATH 环境变量中。
来自 Dockerfile:
RUN dotnet tool install --global dotnet-ef
ENV PATH="$PATH:/root/.dotnet/tools"
Run Code Online (Sandbox Code Playgroud)
可能是您没有安装 EF 工具:
\ndotnet tool install --global dotnet-ef\nRun Code Online (Sandbox Code Playgroud)\n并按照 @Vo\xc4\x8dko 建议添加环境路径:
\nENV PATH="$PATH:/root/.dotnet/tools"\nRun Code Online (Sandbox Code Playgroud)\n
| 归档时间: |
|
| 查看次数: |
6169 次 |
| 最近记录: |