entity-framework 'scaffold-dbcontext' 未被识别为 cmdlet、函数、脚本文件或可操作程序的名称

发布时间 2023-10-09 14:53:43作者: hofmann
// 出现此错
scaffold-dbcontext : The term 'scaffold-dbcontext' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1
//解决办法 包管理器控制台中添加如下几个包
Microsoft.EntityFrameworkCore.Design
Microsoft.EntityFrameworkCore.Tools
Microsoft.EntityFrameworkCore.SqlServer
Scaffold-DbContext -Connection "Server=xxxxxx0001;Database=xxxxxx;Integrated Security=SSPI;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models\DemoDB -force

 

.net core 连接数据库(通过数据库生成Modell) - Royal丶鬼才 - 博客园 (cnblogs.com)