The dotnet dbcontext Scaffold ef and scaffold-dbcontext command does not find the package

NGOUNOU VICTOR PEREZ 1 Reputation point
2022-04-16T00:18:22.897+00:00

I am trying to generate my models from the database using Entity framework via reverse engineering. but the command does not work.
Here is the exact command I entered

dotnet ef dbcontext scaffold  "Data Source=.; Initial Catalog=DiceDatatable; " Microsoft.EntyFrameworkCore.SqlServer --output-dir Models  

it gives me the following error:

193450-image.png

Unable to find provider assembly 'Microsoft.EntyFrameworkCore.SqlServer'. Ensure the name is correct and it's referenced by the project.  

I don't understand what is happening because I installed everything as you can see in the image above

I specify that all the old and new project generates the same error.

the problem occurs after i updated visual studio 2022 from preview to current version.
I am also moving from sql server 2016 to sql server 2022

Environmental Information

EF Core version: 6.4
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: NET 6.0
Operating system: windows 11
IDE: Visual Studio 2022 17.1.4

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
512 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
9,783 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
8,187 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Jaliya Udagedara 2,706 Reputation points MVP
    2022-04-16T04:31:53.24+00:00

    There is a typo: (Microsoft.EntyFrameworkCore.SqlServer) in your command.

    It should be,

    dotnet ef dbcontext scaffold "Data Source=.;Initial Catalog=DiceDatatable; " Microsoft.EntityFrameworkCore.SqlServer --output-dir Models  
    

    And note, you need to have following 2 packages installed,

    Microsoft.EntityFrameworkCore.Design (I see you don't have this installed)  
    Microsoft.EntityFrameworkCore.SqlServer  
    

    193564-image.png

    0 comments No comments