[Issue Resolved]C# & EF Core : why is the migration failing?

internal class MenuDbContext : DbContext
{
    DbSet<Drinks> drinks => Set<Drinks>();
    DbSet<Food> food => Set<Food>();
    DbSet<rezMenu> menu => Set<rezMenu>();

    protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
    {
        optionsBuilder.UseSqlServer(@"Server=DESKTOP-GA3KCB6;Database=Menu_HW;Trusted_Connection=True;MultipleActiveResultSets=true");
    }
}

enter image description here

As per the title, why is the migration failing (I added the EFC.Tools nuget package)?

Whenever I do add-migration [migrationName] from the nuget console, I just get “build failed” with no explanation… I checked a few tutorials online and the code I wrote is pretty much the same (differences were in the DbSet not the OnConfiguring).

Is there a step I missed?

[Edit]Turns out i was an idiot and didnt put anything into the main file…

  • Does your solution build? Because the message says that build failed. Try to fix errors and try again

    – 




  • Run dotnet build in your terminal to see build errors

    – 

Leave a Comment