ReflectionTypeLoadException when I try to run Enable-Migrations with Entity Framework 5.0

Posted by Eric Anastas on Stack Overflow See other posts from Stack Overflow or by Eric Anastas
Published on 2012-10-12T21:30:37Z Indexed on 2012/10/12 21:36 UTC
Read the original article Hit count: 206

Filed under:
|
|
|

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.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET