【发布时间】:2020-02-24 16:23:18
【问题描述】:
我正在尝试计算 entity framework 教程“Creating a Model for an Existing Database in Entity Framework Core // entityframeworktutorial.net”-
当我输入命令时:PM> Scaffold-DbContext" Server =. \ SQLEXPRESS1; Database = SCHOOLDB.MDF; Trusted_Connection = True; " Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
我得到错误:ScriptHalted
使用者:
- Visual Studio - 2019. 社区 - 16.3.6;
- 控制台应用程序。核心 3.0;
- Microsoft.EntityFrameworkCore - 3.0.0;
- Microsoft.EntityFrameworkCore.Tools - 3.0.0;
故事:
- 我安装了“Microsoft.EntityFrameworkCore - 3.0.0;”
- 我运行命令:PM> Scaffold-DbContext" Server =. \ SQLEXPRESS1; Database = SCHOOLDB.MDF; Trusted_Connection = True; " Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
- 我收到一个错误:
The name" Scaffold-DbContext "is not recognized as the name of the cmdlet, function, script file, or executable program. Check for correctness.
spelling of the name, as well as the presence and correctness of the path, then try again.
line: 1 character: 19
+ Scaffold-DbContext <<<< "Server =. \ SQLEXPRESS1; Database = SCHOOLDB.MDF; Trusted_Connection = True;" Microsoft.EntityFrameworkCore.SqlSe
rver -OutputDir Models
+ CategoryInfo: ObjectNotFound: (Scaffold-DbContext: String) [], CommandNotFoundException
+ FullyQualifiedErrorId: CommandNotFoundException
- 我安装了Microsoft.EntityFrameworkCore.Tools(根据推荐-“Scaffold-DbContext 'is not recognized -> require EF Tools // github.com”)`
- 我运行命令:PM> Scaffold-DbContext" Server =. \ SQLEXPRESS1; Database = SCHOOLDB.MDF; Trusted_Connection = True; " Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models
- 我收到一个错误:ScriptHalted
问题。
如何修复“ScriptHalted”错误?
【问题讨论】:
标签: c# sql-server entity-framework