question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Scaffold-DbContext runs successfully but does not create any models

See original GitHub issue

I am using Visual Studio community edition 2022 and trying to update my Models from database in EntityFrameworkCore 6 (I added new tables and modified some). When I run the Scaffold-DbContext command, it runs successfully but does not produce any updates (or new classes) for the models. It created the models the first time, for that I had to add the following in the .csproj file.

<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>

In the <PropertyGroup> element. When I run it now (for update) it builds and runs successfully but doesn’t produce any updates to the models.

I am running the following command in the package manager console:

Scaffold-DbContext "Data Source=myserver;Initial Catalog=ccWebDb;Persist Security Info=True;User ID=*****;Password=*****" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models -Context DataContext -f

When I run this command, I get the following output

Build started...
Build succeeded.
Specify --help for a list of available options and commands.
Unrecognized command or argument 'C#'

Is there something I am missing here?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
AndriySvyrydcommented, Feb 11, 2022

Try adding -Verbose to the command

Try using dotnet ef instead

Uninstall old .NET Core SDKs if there are any and reinstall VS 2022.

1reaction
ErikEJcommented, Feb 6, 2022

Try sharing the actual command line used

Read more comments on GitHub >

github_iconTop Results From Across the Web

Scaffold-DbContext runs successfully but does not create ...
When I run the Scaffold-DbContext command, it runs successfully but does not produce any updates (or new classes) for the models.
Read more >
Learning EF - Error running Scaffold-DbContext
I am learning how to user Entity Framework where the models are built from an existing SQL server. I ran this command in...
Read more >
Entity Framework Core Scaffold-DbContext in separate Data ...
Entity Framework Core, with DB first (Database already available) approach, generates code for a DbContext and Entities for a selected database.
Read more >
Entity Framework Core 5.0 scaffold-dbcontext hangs within ...
I have created my first scaffold-dbcontext command and run it in Package Manager Console in Visual Studio 16.6.2. After 'Build succeeded.
Read more >
Scaffold DBContext not recognized - Brainstorm Creative
This post will help you resolve the 'scaffold-dbcontext is not recognized' message when using the scaffold-dbcontext command in Visual ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found