EF Migrations: Could not load file or assembly EntityFramework, Version=6.0.0.0

ef-migrations entity-framework-6 powershell

Question

I've been trying in vain to get EF to execute my migrations with PowerShell, but I'm not making any progress. I can use the package management interface in Visual Studio to launch them, but when I use a PowerShell script, I receive the following error:

migrate.exe : At line:1 char:1 + & "C:\Development\Ef\Tools\migrate.exe" "TestApp.Data.dll" /connect ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError Unhandled Exception: 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. at System.Data.Entity.Migrations.Console.Resources.EntityRes..ctor()
at System.Data.Entity.Migrations.Console.Resources.EntityRes.GetLoader() at System.Data.Entity.Migrations.Console.Resources.EntityRes.GetString(String name, Object[] args) at System.Data.Entity.Migrations.Console.Program.WriteError(String message) at System.Data.Entity.Migrations.Console.Program.Main(String[] args)

The updated script that I'm using is as follows (created by octopus):

& "C:\Development\Ef\Tools\migrate.exe" "TestApp.Data.dll"  /connectionProviderName="System.Data.SqlClient" /startupConfigurationFile="C:\Development\FeatureBranch\TestApp\TestApp.Root\TestApp.WebApi\web.config" /startUpDirectory="C:\Development\FeatureBranch\TestApp\TestApp.Root\TestApp.WebApi\bin" /Verbose

I know this is a frequent problem since I've done a lot of research on it on Google, so I've done the following checks:

Nuget instals EF version 6.1.3. This is the same for all of the solution's package.config files, i.e.

<package id="EntityFramework" version="6.1.3" targetFramework="net45" />

All of the online and app configurations have been tested, and they are all consistent:

<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />

Although I would believe that nuget would set this appropriately, this seems a little strange to me. In any case, altering these numbers has no impact.

I made sure there weren't any leftover previous versions of the ef. The version of migrate.exe I'm using is the 6.1.3-40302 version that Nuget obtained from my packages folder. I am using.net 4.5, which is the same configuration as the package.

I will try and appreciate any advise; maybe I'm overlooking something simple.

1
0
9/23/2016 9:23:45 AM

Accepted Answer

So, if anybody else has this problem, I was able to resolve it. I developed the script from scratch since the Octopus script wasn't very good. The main problem, at least for me, is that the script must transfer migrate.exe into the folder containing TestApp.Data.dll and then run it from there.

1
9/28/2016 10:50:44 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow