When using Entity Framework Core for a console application i can't scaffold the database.
dotnet ef dbcontext scaffold "Server=;User Id=;Password=;Database=" "Microsoft.EntityFrameworkCore.SqlServer" -c Context -o Models -t Tables -f
Your startup project '' doesn't reference Microsoft.EntityFrameworkCore.Design. This package is required for the Entity Framework Core Tools to work. Ensure your startup project is correct, install the package, and try again.
I've tried to install both Microsoft.EntityFrameworkCore.Design and Microsoft.EntityFrameworkCore.SqlServer.Design. Same problem.
If i set up a new mvc core application i don't get this error. Only when i set up new console applications.
What am i doing wrong?
I ran into a similar problem until I used the Entity Framework Core .NET CLI. Try the following to see if it will work for you:
dotnet new console
dotnet add package Microsoft.EntityFrameworkCore.SqlServer
dotnet add package Microsoft.EntityFrameworkCore.Design
dotnet ef -h
You should see the EFC CLI Options screen. Do the following to scaffold (replace connection string with your own):
dotnet ef dbcontext scaffold "Server=.\;Database=AdventureWorksLT2012;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -o Model
Once you to that, you should see a Model folder in your project with the class files representing the entities.