我尝试在VisualStudio2022,EntityFramework 6上添加迁移,但它不起作用。我犯了个错误
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
我需要帮助。非常感谢
发布于 2022-07-05 07:42:38
对于使用Visual 2022时确实有此问题的人,请切换回Visual 2019,因为当您使用旧的实体框架版本时,2022版本中该版本还不能工作。
在实体框架6 GitHub存储库上的相关问题文件上,项目成员ajcvickers 评论2021-11-18:
[...] 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或升级实体框架,因为这些更改可能会破坏管道。
https://stackoverflow.com/questions/72855219
复制相似问题