Matthew Goulart
Matthew Goulart

Reputation: 3065

Scaffold-DbContext doesn't produce models

I am trying to run Scaffold-DbContext to generate some models from an old system. I am running the following command:

Scaffold-DbContext "Data Source=localhost\SQLEXPRESS;Initial Catalog=MAINT_TRAINING;Integrated Security=True" Microsoft.EntityFrameworkCore.SqlServer

The problem is that I get absolutely no output... No models, no errors, no confirmations...

The tables in the DB all have primary keys.

Am I doing something wrong?

Upvotes: 4

Views: 1619

Answers (2)

Ralph W
Ralph W

Reputation: 33

I had this same issue which is what brought me here. I realized that my user did not have the proper permissions set on the database. I updated the permissions for my user on the database to select/insert/update, and it then produced the models.

Upvotes: 0

bricelam
bricelam

Reputation: 30415

You may be hitting issue #10298. Try adding the following to your *.csproj:

<PropertyGroup>
  <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
</PropertyGroup>

Upvotes: 2

Related Questions