ReflectionTypeLoadException when I try to run Enable-Migrations with Entity Framework 5.0
- by Eric Anastas
I'm trying to use Entity Framework for the first time on one of my projects. I'm using the code first workflow to automatically create my database. Intitaly setting up the database worked fine. Now I'm trying to migrate changes in my classes into the database.
The tutorial I'm reading says I need to run "Enable-Migrations" in the package manager console. Yet when I do this I get the following error
PM> Enable-Migrations
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.FindType[TBase](String typeName, Func`2 filter, Func`2 noType, Func`3 multipleTypes, Func`3 noTypeWithName, Func`3 multipleTypesWithName)
at System.Data.Entity.Migrations.Design.ToolingFacade.GetContextTypeRunner.RunCore()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
What am I doing wrong? How do I retrieve the loader exceptions property? Also NuGet says I have EF 5.0, but Version property of the EntityFramework item in my project references says 4.4.0.0. I'm not sure if this is related.