0

I am building a simple ASP.NET Core web application so I used Entity Framework Core to generate the database for me, using a code-first approach.

I tried to add migrations, but I get this error :

No migrations configuration type was found in the assembly 'WeReadForYou'. (In Visual Studio you can use the Enable-Migrations command from Package Manager Console to add a migrations configuration).

So I tried to enable migrations, but then I get this error:

No context type was found in the assembly 'WeReadForYou

Enable migration error:

enable migration error

I spent hours to solve the problem, I found a lot of similar questions and solutions, but none of them worked me.

This is the code the DbContext Class :

using System;
using Microsoft.EntityFrameworkCore;

namespace WeReadForYou.Models
{
    public class AppDBContext : DbContext
    {
         public AppDBContext(DbContextOptions<AppDBContext> options) : base(options)
         {
         }

         public DbSet<Book> Books { get; set; }
         public DbSet<Author> Authors { get; set; }
         public DbSet<Gender> Genders { get; set; }
         public DbSet<Quote> Quotes { get; set; }
    }
}
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
jihed
  • 1

1 Answers1

0

Are you sure your packagemanager cli is targeted on the project where your context is located?

Sometimes reinstalling the nuget package seems to help aswel.