add-migration InitialMigration和update-database都出現同樣的結果
求問各位大神為什么會出現如圖問題啊?
已經安裝了Microsoft.EntityFramework / Microsoft.EntityFramework.Tools / Microsoft.EntityFramework.SqlServer
求問各位大神為什么會出現如圖問題啊?
已經安裝了Microsoft.EntityFramework / Microsoft.EntityFramework.Tools / Microsoft.EntityFramework.SqlServer
2020-04-12
舉報
2020-05-07
hello 同學好啊,問題解決了嗎?這是個比較少見的問題。搜了一下網上的答案,發(fā)現類似的問題,https://github.com/dotnet/efcore/issues/16386?
帖主也出現了同樣的問題,后來他卸載了visual studio 的 Azure developmen組件,就解決了。后來也有人回復說碰上同樣的問題,用vs 2019就報錯,用vs 2017就可以。后來還有個人說,他的電腦是惠普的,在他電腦上運行就不行,拿到別人的電腦就可以。。。??傊?,這個問題似乎有很多人都碰到過。
然后我看了,他們的解決方式,感覺都不太靠譜。
不過有兩個人的解決方式值得參考一下,他們說vs 2019不行,但是vs 2017就可以,所以我在想或許真的是visual studio所導致的問題。
所以,你可以做一下兩個嘗試
下載個vs 2017試試看。
使用 dotnet cli(命令行)代替使用 package-manage-console
)打開命令行,全局安裝 dotnet-ef: dotnet tool install --global dotnet-e
)關閉命令行,重新打開,cd進入項目文件夾
)輸入dotnet ef命令:dotnet ef migrations add InitialMigration
)如果成功,繼續(xù)輸入命令:dotnet ef database update
2020-04-15
確實有點奇怪,試試下載課程的源碼試試看:https://github.com/Yaduo/LanzhouBeefNoodles,如果還有問題,留言下來,我再看看
2020-07-22
https://cloud.tencent.com/developer/ask/222513
這個帖子給了一個解決方案:
嘗試將此添加到.csproj文件中
我使用的這個方法解決的問題
2020-04-16
換到3.1之后報錯
PM> add-migration InitialMigration
Build started...
Build succeeded.
System.IO.FileLoadException: Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'
? ?at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.AddMigration(String name, String outputDir, String contextType)
? ?at Microsoft.EntityFrameworkCore.Design.OperationExecutor.AddMigrationImpl(String name, String outputDir, String contextType)
? ?at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.<>c__DisplayClass3_0`1.<Execute>b__0()
? ?at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Could not load file or assembly 'netstandard, Version=2.1.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
2020-04-14
把Project.dll也復制過去之后報錯
Your startup project 'project' doesn't reference Microsoft.EntityFrameworkCore.Design. This package is required for the Entity Framework Core Tools to work. Ensure your startup project is correct, install the package, and try again.
令人頭禿?已經安裝了一下這些?還是不行
2020-04-14
之前錯誤顯示不全是因為路徑有中文...改成英文之后報錯是
PM> add-migration InitialMigration
The specified deps.json [F:\project\project.deps.json] does not exist
我的該文件在F:\project\bin\Debug\netcoreapp2.2里面?試著把他復制到F:\project之后報錯為
Error:
? An assembly specified in the application dependencies manifest (project.deps.json) was not found:
? ? package: 'project', version: '1.0.0'
? ? path: 'project.dll'
誰來救救孩子...