Please can you tell me how I solve this problem?
Code to scaffold:
scaffold-dbcontext "server=.\DESKTOP-UO195S8; database=BooksDB; integrated security=false;User ID=sa;Password=shvi"
Microsoft.EntityFrameworkcore.sqlserver -OutputDir models
SHORT SOLUTION: downgrade to version 3.1.15 of everything of .net core 3.1 assemblies (2022 update: you also may need to upgrade to the latest version available)
EXPLANATION: You should check if you have the same version of
Microsoft.VisualStudio.Web.CodeGeneration.Designas you current version ofMicrosoft.EntityFrameworkCore.SqlServer. For some unknown reasons, the last stable version ofMicrosoft.VisualStudio.Web.CodeGeneration.Designis3.1.15while the default stable version ofMicrosoft.EntityFrameworkCore.SqlServeris currently3.1.18(see picture 1)Therefore, when you run the scolding command, it tries to install a version which really is not compatible with the versions inside your project(possibly)
Vs
Downgrading to 3.1.15 and bob is your uncle