Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EF Update-Database Error: Value cannot be null Parameter name: type

I try to execute command update-database in PMC and always get this error msg. I know theres another article basically has the same error but i tried every answer and nothing works.

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.UpdateDatabaseCommand.<>c__DisplayClass2.<.ctor>b__0()
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)

Value cannot be null.
Parameter name: type

BTW I'm using VS2022 preview.

like image 998
somniloquist_ Avatar asked Sep 14 '21 01:09

somniloquist_


1 Answers

Try updating EntityFramework package to the latest version. I was having the same problem with EF 6.1.3, but then updated to 6.4.4 and it worked fine on VS2022 preview.

like image 115
Guillherme Avatar answered Oct 29 '22 03:10

Guillherme