.NET做數據遷移安裝dotnet -ef命令工具
可能的原因包括:
*你拼錯了內置的 dotnet 命令。
*你打算執行 .NET Core 程序,但 dotnet-ef 不存在。
*你打算運行全局工具,但在路徑上找不到名稱前綴為 dotnet 的可執行文件。
.net core3.0 以上版本dotnet ef命令不在是sdk的一部分,需要單獨安裝,使用如下命令:(最新版)
dotnet tool install --global dotnet-ef
該命令默認安裝的是最新版本,如果項目中使用的並不是最新版本,則還是不能使用,安裝對應版本使用如下命令:(指定版本)
dotnet tool install --global dotnet-ef --version 3.1.1
不注意安裝錯誤可使用卸載命令:
dotnet tool uninstall --global dotnet-ef
dotnet-ef安裝成功后,還需要給項目引用nuget包:
dotnet add package Microsoft.EntityFrameworkCore.Design
操作失敗的話檢查一下版本號即可