架构师_程序员_码农网

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

搜索
查看: 25663|回复: 4

[资料] ef 执行Add-Migration报错解决方案

[复制链接]
发表于 2018-7-5 16:24:26 | 显示全部楼层 |阅读模式
Your startup project 'XXX' doesn't reference Microsoft.EntityFrameworkCore.Design. This package is required for the Entity Framework Core Tools to work. Ensure your startup project is correct, install the package, and try again.


QQ截图20180705162131.jpg

在执行命令的时候,最下面有个黄色提示,如下:

Both Entity Framework Core and Entity Framework 6 are installed. The Entity Framework Core tools are running. Use 'EntityFramework\Add-Migration' for Entity Framework 6.
实体框架核心和实体框架6都已安装。 实体框架核心工具正在运行。 为Entity Framework 6使用“EntityFramework \ Add-Migration”。

解决办法:



Both Entity Framework 6.x and Entity Framework Core commands are installed. The Entity Framework 6 version is executing. You can fully qualify the command to select which one to execute, 'EntityFramework\Add-Migration' for EF6.x and 'EntityFrameworkCore\Add-Migration' for EF Core.

安装了Entity Framework 6.x和Entity Framework Core命令。 Entity Framework 6版本正在执行。 您可以完全限定命令以选择要执行的命令,EF6.x的“EntityFramework \ Add-Migration”和EF Core的“EntityFrameworkCore \ Add-Migration”。




上一篇:求助校园教务管理系统密码恢复
下一篇:纯html5 css3实现的404页面
码农网,只发表在实践过程中,遇到的技术难题,不误导他人。
 楼主| 发表于 2019-2-13 13:08:46 | 显示全部楼层
如果想要获取PowerShell命令的详细帮助信息,比如Enable-Migration,只需要输入Get-Help Enable-Migrations,其他命令依次类推。

更多参考微软官方文档:超链接登录可见。
码农网,只发表在实践过程中,遇到的技术难题,不误导他人。
发表于 2019-2-13 13:19:31 | 显示全部楼层
mark
码农网,只发表在实践过程中,遇到的技术难题,不误导他人。
 楼主| 发表于 2023-6-21 22:39:28 | 显示全部楼层
VS 2022 执行迁移命令会报错,使用 VS 2019 即正常。

PM> EntityFramework\Add-Migration test
Both Entity Framework 6.x and Entity Framework Core commands are installed. The Entity Framework 6 version is executing. You can fully qualify the command to select which one to execute, 'EntityFramework\Add-Migration' for EF6.x and 'EntityFrameworkCore\Add-Migration' for EF Core.
System.ArgumentNullException: 值不能为 null。
参数名: type
   在 System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   在 System.Activator.CreateInstance(Type type, Object[] args)
   在 System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetProjectTypes(Project project, Int32 shellVersion)
   在 System.Data.Entity.Migrations.Extensions.ProjectExtensions.IsWebSiteProject(Project project)
   在 System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetTargetDir(Project project)
   在 System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName, Boolean useContextWorkingDirectory)
   在 System.Data.Entity.Migrations.AddMigrationCommand.Execute(String name, Boolean force, Boolean ignoreChanges)
   在 System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
值不能为 null。
参数名: type

码农网,只发表在实践过程中,遇到的技术难题,不误导他人。
 楼主| 发表于 2023-7-14 20:55:15 | 显示全部楼层
小渣渣 发表于 2023-6-21 22:39
VS 2022 执行迁移命令会报错,使用 VS 2019 即正常。

PM> EntityFramework\Add-Migration test


VS 2022 解决方案

无法加载模块“EntityFramework”。有关详细信息,请运行“Import-Module EntityFramework”


升级到 EntityFramework.6.4.4 版本,执行如下命令:

码农网,只发表在实践过程中,遇到的技术难题,不误导他人。
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

免责声明:
码农网所发布的一切软件、编程资料或者文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:help@itsvse.com

QQ|手机版|小黑屋|架构师 ( 鲁ICP备14021824号-2 )|网站地图

GMT+8, 2025-7-31 22:09

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表