Search code examples
asp.netentity-frameworkasp.net-coredatabase-first

Asp.Net Core 2.0 error while scaffolding my database to generate Models


I'm getting this error:

Could not load type 'Microsoft.EntityFrameworkCore.Infrastructure.DesignTimeProviderServicesAttribute' from assembly 'Microsoft.EntityFrameworkCore, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.

while trying to run this command in Package Manager Console Scaffold-DbContext "server=localhost;port=3306;user=root;database=frisbee_admin" MySql.Data.EntityFrameworkCore -OutputDir Models -f

Any Idea why ?


Solution

  • Try it as follows:

    Scaffold-DbContext -Connection "server=localhost;port=3306;user=root;database=frisbee_admin" -Provider MySql.Data.EntityFrameworkCore -OutputDir Models -context YourDbContext -Project YourProjectName -Force