'Scaffold-DbContext runs successfully but does not create any models

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?



Solution 1:[1]

There is no -f option.

Did you mean -Force ?

Solution 2:[2]

Check out your db users permission. If you have only read permission, it could not be enough. If you can have admin role, try with admin permission.

sample image

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 ErikEJ
Solution 2 ygugen