No migrations configuration type was found in the assembly 'DemoServer'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration)[在程序集“DemoServer”中没有找到迁移配置类型]

 

启动项选择了"Demo",默认目录选择了DemoServer,尝试使用 Enable-Migrations

又出现了报错(No context type was found in the assembly 'DemoServer'.[

在程序集“DemoServer”中没有找到上下文类型。])

 

 

解决方法如下:

第一,看一下是否有两个以上的DBcontext,就指明要哪一个上下文类型,但是我只有一个,说明不是第一个

第二个,先看一下你选择的默认项目中是否有装了,EntityFramework(6.4.4)和Microsoft.EntityFrameworkCore(6.0.8)

 

 

 

第一个是我也不知道怎么装上的先不管,第二个是自己装的要保留(要用到EF框架),把第一个删除掉就欧克了记得重启VS

 

 

 

下面开始 Add-Migration xxxxxxx

 

 

 

然后 Update-Database

再然后去看看数据库有没有

posted on 2022-08-26 09:57  就叫小顺吧  阅读(939)  评论(0编辑  收藏  举报