migrate.exe无法加载entityframework

时间:2015-03-17 21:27:54

标签: c# entity-framework ef-migrations

我尝试在我的构建服务器上设置migrate.exe之前尝试在本地使用migrate.exe,但我甚至无法运行帮助命令/?而不会收到错误

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.

我一直在寻找解决方案,遇到Microsoft's migrate.exe getting started page等问题,但是我们无法解决这个问题。

我已经尝试将migrate.exe文件复制到我的项目/bin/Debug文件夹以及项目的dll和实体框架dll中,但我仍然看到此错误(截图显示在下面)。

我还验证了实体框架的dll版本,它确实是6.0.0.0。我使用nuget来包含实体框架,而我目前正在使用<package id="EntityFramework" version="6.1.3" targetFramework="net45" />

非常感谢任何建议或帮助!

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

1 个答案:

答案 0 :(得分:2)

您是否在.NET版本中使用了正确的EF程序集?

我的应用程序是使用.NET 4.5生成的,因此我使用 \ packages \ EntityFramework.6.1中的程序集 EntityFramework.dll EntityFramework.SqlServer.dll 来自 \ packages \ EntityFramework.6.1.0 \ tools 的.0 \ lib \ net45 migrate.exe

尝试使用 startUpDirectory startUpConfigurationFile 参数的绝对路径。

例如:

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

HTH

相关问题