我一般不喜欢Entity Framework和ASP.NEt。.我安装了EF,当我编写enable-migrations时,我看到了以下内容:在程序集“ Demogorgon”中找不到上下文类型。
我试图 1.安装和卸载EF 2.确保我选择了正确的项目作为默认项目(很容易,下拉菜单中只有一个) 3.用于安装EF控制台或管理nuget 4.我经常在这里和其他地方阅读答案,但是由于我对此很陌生,所以我不是怎么做
Attempting to gather dependency information for package 'EntityFramework.6.4.4' with respect to project 'Demogorgon', targeting '.NETFramework,Version=v4.7.2'
Gathering dependency information took 1.14 sec
Attempting to resolve dependencies for package 'EntityFramework.6.4.4' with DependencyBehavior 'Lowest'
Resolving dependency information took 0 ms
Resolving actions to install package 'EntityFramework.6.4.4'
Resolved actions to install package 'EntityFramework.6.4.4'
Retrieving package 'EntityFramework 6.4.4' from 'nuget.org'.
Adding package 'EntityFramework.6.4.4' to folder 'C:\Users\novot\source\repos\Demogorgon\packages'
Added package 'EntityFramework.6.4.4' to folder 'C:\Users\novot\source\repos\Demogorgon\packages'
Added package 'EntityFramework.6.4.4' to 'packages.config'
**Successfully installed 'EntityFramework 6.4.4' to Demogorgon**
Executing nuget actions took 1.49 sec
Time Elapsed: 00:00:02.7731151
PM> Enable-Migrations
No context type was found in the assembly 'Demogorgon'.
PM> enable-migrations
No context type was found in the assembly 'Demogorgon'.
PM>
答案 0 :(得分:0)
确保在Package Manager控制台(默认项目下拉选项)中选择了正确的项目(DBContext类所在的项目),然后重试