No context type was found in the assembly No context type was found in the assembly asp.net asp.net

No context type was found in the assembly


I eventually found the answer in this question. Basically, in the Package Manager Console there's a "Default project" dropdown. You need to set this to the project that contains your EF context.


I found similar post: Enable Migrations with Context in Separate Assembly?

Example:

enable-migrations -ContextProjectName MyProject.DBContexts -contexttypename MyProject.DBContexts.MyContextName -Verbose


For whom who made this mistake like I did:

Your context class must inherits from DbContext, just like that:

public class DirectorRequestContext : DbContext{    public DbSet<DirectorRequest> DirectorRequests { get; set; }}