简体   繁体   English

.net核心EntityFramework“添加迁移”无效

[英].net core EntityFramework “Add-Migration” not working

After I deleted the Database in (localdb)\\MSSqlLocalDB and Contents of the Migrations folder in my .NET Core MVC Project, I expected it to create a new Migration and lets me create the Database with "Add-Migration Init" and "Update-Dabase". 在删除(localdb)\\ MSSqlLocalDB中的数据库以及.NET Core MVC项目中的Migrations文件夹的内容之后,我希望它创建一个新的Migration,并让我使用“ Add-Migration Init”和“ Update- Dabase”。 However it won't create the Migration due to not finding the Database (Error Code: 4060). 但是,由于找不到数据库,它不会创建迁移(错误代码:4060)。 I don't understand how I can create the Database from PMC when it says that. 我不明白我怎么能从PMC创建数据库。 And I don't understand why it tells me that. 而且我不明白为什么它告诉我这一点。

Try to clean up your project and re-build it. 尝试清理您的项目并重新生成它。 What also work by me is to close and restart visual studio. 我还可以使用的方法是关闭并重新启动Visual Studio。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM