"If you receive an error stating The term 'Scaffold-DbContext' is not recognized as the name of a cmdlet, then close and reopen Visual Studio."
Actual solution is to install nuget package Microsoft.EntityFrameworkCore.Tools
âš Dit gedeelte niet bewerken. Het is vereist om problemen te koppelen tussen docs.microsoft.com en GitHub.
Yes, they should mention this in the instructions
Yes, especially since this page appears prominently in google search
Just hit by this.
thx for sharing.
I ran into this on a console app. Installing Microsoft.EntityFrameworkCore.Tools didn't help, even after a VS restart. I used the EF CLI to scaffold.
dotnet ef dbcontext scaffold "Server=.\;Database=AdventureWorksLT2012;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -o Model
Refer to this, it will make your life easier
https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/powershell
To resolve this issue, you will have to run this command in the package manager console Install-Package Microsoft.EntityFrameworkCore.Tools before to run the Scaffold-DbContext command, hope it help !
I had to start Visual Studio as an administrator to get it to work. Probably due to local policies in on our computers at my work...
@bricelam @Rick-Anderson It looks like ASP.NET tutorial gets the package through ASP.NET scaffolding, so it doesn't need to be explicitly installed. Do you think we should change anything here?
Yes, VS installs all the scaffolding packages and tools. If you select the VSC tab, it provides full instructions.
The meta-data in this issue points to our repo, why is this issue in the EF repo?
This page gets 22K PV/Month with a 92% CSAT.
Recommend closing.
Most helpful comment
To resolve this issue, you will have to run this command in the package manager console Install-Package Microsoft.EntityFrameworkCore.Tools before to run the Scaffold-DbContext command, hope it help !