首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法在Visual 2022中运行添加迁移,首先运行EF6代码

无法在Visual 2022中运行添加迁移,首先运行EF6代码
EN

Stack Overflow用户
提问于 2022-07-04 10:22:42
回答 1查看 622关注 0票数 1

我尝试在VisualStudio2022,EntityFramework 6上添加迁移,但它不起作用。我犯了个错误

代码语言:javascript
运行
复制
PM> EntityFramework\Add-Migration -ConfigurationTypeName STS.Core.Migrations.Configuration "AddCheckChanges"
System.ArgumentNullException: Value cannot be null.
Parameter name: type
   at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
   at System.Activator.CreateInstance(Type type, Object[] args)
   at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetProjectTypes(Project project, Int32 shellVersion)
   at System.Data.Entity.Migrations.Extensions.ProjectExtensions.IsWebSiteProject(Project project)
   at System.Data.Entity.Migrations.Extensions.ProjectExtensions.GetTargetDir(Project project)
   at System.Data.Entity.Migrations.MigrationsDomainCommand.GetFacade(String configurationTypeName, Boolean useContextWorkingDirectory)
   at System.Data.Entity.Migrations.AddMigrationCommand.Execute(String name, Boolean force, Boolean ignoreChanges)
   at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Value cannot be null.
Parameter name: type

我需要帮助。非常感谢

EN

回答 1

Stack Overflow用户

发布于 2022-07-05 07:42:38

对于使用Visual 2022时确实有此问题的人,请切换回Visual 2019,因为当您使用旧的实体框架版本时,2022版本中该版本还不能工作。

实体框架6 GitHub存储库上的相关问题文件上,项目成员ajcvickers 评论2021-11-18

代码语言:javascript
运行
复制
[...] EF 6.2 doesn't work. You will need to update to EF 6.4.4. We have so far been unable to reproduce this with EF 6.4.4.

虽然许多用户报告说升级到EF 6.4.4解决了他们的问题,但问题仍然存在,因为有些用户无法降级到Visual 2019或升级实体框架,因为这些更改可能会破坏管道。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/72855219

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档