net core生成数据库,使用Scaffold-DbContext报错“‘Scaffold-DbContext’ is not recognized as the name of a cmdlet”

win7,64位,vs2015

net core生成数据库,使用Scaffold-DbContext报错“‘Scaffold-DbContext’ is not recognized as the name of a cmdlet”

学习的生成数据库信息的文章来自:http://www.cnblogs.com/baobaodong/p/5871357.html

运行的代码是:PM> Scaffold-DbContext  "Data Source=.;Initial Catalog=test;User ID=sa;Password=sa1234" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Modles


就在网上搜索下,找到一篇:http://www.genshuixue.com/i-cxy/p/12865486


之后我吧代码加上,再次运行 Scaffold-DbContext 


提示我powershell版本需要升级,我就从网上下载一个powershell3进行安装,重新启动电脑,但是还是不行,看到如下错误代码

下面看到的错误信息,有看到包名就进行安装下

PM> Scaffold-DbContext  "Data Source=.;Initial Catalog=test;User ID=sa;Password=sa1234" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Modles
System.AggregateException: One or more errors occurred. ---> Microsoft.EntityFrameworkCore.Design.OperationException: Unable to find design-time provider assembly. Please install the Microsoft.EntityFrameworkCore.SqlServer.Design NuGet package and ensure that the package is referenced by the project. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.EntityFrameworkCore.SqlServer.Design, Version=1.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. 系统锟揭诧拷锟斤拷指锟斤拷锟斤拷锟侥硷拷锟斤拷    at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolea n suppressSecurityChecks)
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
   at System.Reflection.Assembly.Load(AssemblyName assemblyRef)
    at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.GetProviderDesignTimeServices(String provider, Boolean throwOnError) 
   --- End of inner exception stack trace ---
   at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.GetProviderDesignTimeServices(String provider, Boolean throwOnError)
    at Microsoft.EntityFrameworkCore.Design.Internal.DesignTimeServicesBuilder.Build(String provider)
    at Microsoft.EntityFrameworkCore.Design.DatabaseOperations.ReverseEngineerAsync(String provider, String connectionString, String outputDir, String dbContextClassName, IEnumerable`1 schemas, IEnumerable`1 tables, Boolean useDataAnnotations, Boolean overw riteFiles, CancellationToken cancellationToken)
    at Microsoft.EntityFrameworkCore.Design.Internal.OperationExecutor.ReverseEngineerAsync(String provider, String connectionString, String outputDir, String dbContextClassName, IEnumerable`1 schemaFilters, IEnumerable`1 tableFilters, Boolean useDataAnnota tions, Boolean overwriteFiles, Cancell
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值