Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The term 'Scaffold-DbContext' is not recognized as the name of a cmdlet

I have a solution with two project, one is the main project and the second a project that will use EF Core 10.0 RC2.

In the second project I use this three commands to install EF Core and run this nuget commands to install it:

Install-Package Microsoft.EntityFrameworkCore.SqlServer –Pre
Install-Package Microsoft.EntityFrameworkCore.Tools –Pre
Install-Package Microsoft.EntityFrameworkCore.SqlServer.Design –Pre

Later I can create my model from a database with this command:

Scaffold-DbContext "'Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;'" Microsoft.EntityFrameworkCore.SqlServer

The problem is that if I exit VS2015 and open again, if I have tried to run the same command to generate again the models, I get this error:

The term 'Scaffold-DbContext' is not recognized as the name of a cmdlet.

I don't know what is the problem, I have tried to install the entityFrameworks.Commands but the problem is not solved.

like image 388
Álvaro García Avatar asked Oct 19 '22 07:10

Álvaro García


1 Answers

Have you tried the command:

dotnet restore --infer-runtimes

For more information, you can visit: https://github.com/aspnet/EntityFramework/issues/5549, it worked for someone.

like image 89
VincentZHANG Avatar answered Nov 15 '22 09:11

VincentZHANG