Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

migrate.exe could not load entityframework

I'm trying to use migrate.exe locally before setting it up on my build server, but I can't even run the help command /? without getting the error

System.IO.FileNotFoundException: Could not load file or assembly 
'EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
or one of its dependencies. The system cannot find the file specified.

I've been browsing around for solutions, coming across Microsoft's migrate.exe getting started page among other things, but haven't been able to solve this.

I've tried copying the migrate.exe file into my projects /bin/Debug folder alongside the project's dll and the entity framework dll, but I continue to see this error (screenshot showing it below).

I've also verified the version of the dll for entity framework, and it is indeed 6.0.0.0. I'm using nuget to include entity framework, and I'm currently using <package id="EntityFramework" version="6.1.3" targetFramework="net45" />.

Any recommendations or help is much appreciated!

proof that I'm copying the migrate.exe file into my projects /bin/Debug directory

like image 327
JesseBuesking Avatar asked Mar 17 '15 21:03

JesseBuesking


1 Answers

Are you using the right EF assemblies for your .NET version?.

My app is generated with .NET 4.5, so I use the assemblies EntityFramework.dll and EntityFramework.SqlServer.dll from \packages\EntityFramework.6.1.0\lib\net45 and migrate.exe from \packages\EntityFramework.6.1.0\tools.

Try to use absolute path for startUpDirectory and startUpConfigurationFile arguments.

For example:

migrate.exe MyAssembly.dll /startUpDirectory="C:\MyApp\bin" /startUpConfigurationFile="C:\MyApp\App.config"

HTH

like image 61
Neburnz Avatar answered Sep 21 '22 07:09

Neburnz