一般Windows7默认安装的是PowerShell 2.0

使用Vs2017开发.Net Core时。使用 EntityFrameworkCore Db First自动生成实体时需要用到下面命令:

Scaffold-DbContext "Server=localhost;Database=SunnyTask;UID=sa;PWD=Kingsun2008" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Database\Models

如果PowerShell 2.0会出一个版本过低的错误,导致无法生成实体。

所以我们要升级PowerShell 

升级方法:

在微软官方地址下载PowerShell 3.0 安装。

https://www.microsoft.com/en-us/download/details.aspx?id=34595

Windows7 64位下载:Windows6.1-KB2506143-x64.msu

成功下载安装后,重启电脑。

开机后再运行命令即可生成实体。

相关文章:

  • 2021-06-11
  • 2021-10-30
  • 2022-12-23
  • 2022-02-20
  • 2022-12-23
  • 2022-01-17
  • 2021-07-01
  • 2022-03-01
猜你喜欢
  • 2022-12-23
  • 2021-08-27
  • 2022-12-23
  • 2021-12-29
  • 2021-05-22
  • 2021-10-10
  • 2021-12-10
相关资源
相似解决方案