1. 程式人生 > >.net core執行dotnet ef migrations createmodel、dotnet ef migrations add initial等命令出錯

.net core執行dotnet ef migrations createmodel、dotnet ef migrations add initial等命令出錯

.net core執行dotnet ef migrations createmodel、dotnet ef migrations add initial等命令出錯

  執行dotnet ef migrations createmodel、dotnet ef migrations add initial等命令出錯,報錯資訊為:No project was found. Change the current working directory or use the --project option.命令出錯。個人百度.net core、dotnet ef migrations createmodel、dotnet ef migrations add initial、No project was found. Change the current working directory or use the --project option關鍵字都未發現這個問題的解決辦法,最後使用必應國內版,搜尋No project was found. Change the current working directory or use the --project option.關鍵字,得到了解決辦法。

  第一種:dotnet ef migrations add InitialCreate --project="C:\path_to_my_project\MyProject.csproj"   使用這樣的命令操作,在我寫的程式碼沒有作用,依然報出之前的問題;

  第二種:PM> cd "D:{path_to_your_projet}"  PM> dotnet ef migrations add initial 使用第二種方法解決了,不可以使用dotnet ef migrations createmodel、dotnet ef migrations add initial命令的問題。

   參考文章:Stack Overflow  GitHub