EF 5 and VS 11 error on add-migrations

I just installed VS 11 and created a class library project. Then I added the beta version of the framework 5 entity. Then I created a simple user class and a dbcontext class. Then I used the "Enable-Migrations -EnableAutomaticMigrations" console command which worked great and added the appropriate migrations directory and config file. The problem is when I run "Add-Migrtion InitialMigration" I get the following error.

System.Reflection.TargetInvocationException: An exception was thrown by the target of the invocation. ---> System.IO.FileNotFoundException: Could not load file or assembly "System.Data.Entity, Version = 4.2.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089" or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly "System.Data.Entity, Version = 4.0.0.0, Culture = neutral, PublicKeyToken = b77a5c561934e089" or one of its dependencies. The system cannot find the file specified.

I had EF 4.2 installed previously, but I uninstalled it. Actually after I tried this for the first time and it failed, I uninstalled VS, SQL and everything related. Then I rebooted and installed a simple visual studio 11 installation and tried again but still get the same error. I suspect this is due to a previous installation of the framework, but I don't know how to fix it.

I am running Win 7 I have tried gacutil as described here Can anyone understand why I keep getting this error while testing out the EF 5 beta, but found nothing to fix. / P>

+3


source to share


2 answers


System.Data.Entity.dll 4.2.0.0 was only shipped as part of the EF June 2011 CTP. It looks like either the code you are compiling is referencing this assembly, or some other code it uses is expecting this assembly. Check the references in your project to make sure that they do not reference this assembly, and that any other projects or assemblies that are referenced do not themselves reference this assembly. If you find the links, then you will need to remove them and rebuild with .NET 4.5 and EntityFramework.dll 5.0.



0


source


The best way to fix it is removing this folder from the GAC after unistall CTP:



Windows \ Microsoft.NET \ assembly \ GAC_MSIL \ policy.4.0.system.data.entity

0


source







All Articles