'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 1:[1]

Install fallowing NuGet package:

Install-Package Microsoft.EntityFrameworkCore.SqlServer

Solution 2:[2]

I was getting the following error when trying to scaffold from an existing SQLite database:

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

The project was in a solution with one other project. Even though the correct project was referenced in the Package Manager Console it only worked when I selected the 'Set as Startup Project' item on the project context menu.

Solution 3:[3]

Close Visual Studio
Delete %temp% folder
Delete .vs folder

dotnet ef dbcontext scaffold "Server=REMOVED;Database=REMOVED;User ID=REMOVED;Password=REMOVED" Microsoft.EntityFrameworkCore.SqlServer

Solution 4:[4]

  1. Install Microsoft.EntityFrameworkCore.SqlServer from Nuget

  2. In PM set the default project to the project that will contain the Models folder, then in PM...

PM> Scaffold-DbContext "Server=YOURSERVER;database=YOURDB;Trusted_Connection=True;" MicrosoftEntityFrameworkCore.SqlServer -OutputDir Models -force

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Amirhossein Yari
Solution 2 John
Solution 3 David Buck
Solution 4 James