Search code examples
ef-code-firstasp.net-coreentity-framework-core

How to scaffold EF core to existing DB?


I am trying to reverse engineer an existing database using Entity Framework Core. I tried to follow the directions from Microsoft but I am presented with the error:

Unable to find provider assembly with name EntityFramework. Ensure the specified name is correct and is referenced by the project.

I am running the following command from the project directory:

dnx ef dbcontext scaffold "Server=REMOVED;Database=REMOVED;User ID=REMOVED;Password=REMOVED" EntityFramework

What am I doing wrong?


Solution

  • Make sure you are in the project folder and not the solution folder context. I was able to get this to work with the following yesterday (Notice the EntityFramework.MicrosoftSqlServer at the end)

    dnx ef dbcontext scaffold "{connectionString}" EntityFramework.MicrosoftSqlServer
    

    EDIT:

    Make sure to include the following in your project.json:

    EntityFramework.MicrosoftSqlServer.Design