术语“脚手架DbContext”不被识别为cmdlet的名称 [英] The term 'Scaffold-DbContext' is not recognized as the name of a cmdlet

查看:2168
本文介绍了术语“脚手架DbContext”不被识别为cmdlet的名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个项目的解决方案,一个是主要项目,另一个是使用EF Core 10.0 RC2的项目。



在第二个项目中,我使用这三个命令安装EF Core并运行这个nuget命令来安装它:

  Install-Package Microsoft.EntityFrameworkCore.SqlServer -Pre 
安装包Microsoft.EntityFrameworkCore.Tools -Pre
安装包Microsoft.EntityFrameworkCore.SqlServer.Design -Pre

稍后,我可以使用以下命令从数据库创建我的模型:

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

问题是,如果我退出VS2015并再次打开,如果我尝试运行相同的命令再次生成模型,我得到这个错误:


术语脚手架DbContext不是确认为
cmdlet的名称。


我不知道是什么问题,我已经尝试安装实体框架命令但是问题没有解决。

解决方案

你是否尝试过这个命令:

  dotnet restore --infer-runtimes 

有关详细信息,请访问: https://github.com/aspnet/EntityFramework/issues / 5549 ,它适用于某人。


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.

解决方案

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.

这篇关于术语“脚手架DbContext”不被识别为cmdlet的名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆