I used VS2010 under Win7(x64 ), installed Nuget and install the EF Package. And can read and write DB successful. But I want to Enable Migration used the Nuget Package Manager Console, then I will encounter the error as below:
System.BadImageFormatException: Could not load file or assembly 'EnvDTE, Version=18.104.22.168, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The module was expected to contain an assembly manifest.
File name: 'EnvDTE, Version=22.214.171.124, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ---> System.BadImageFormatException: The module was expected to contain an assembly manifest. (Exception from HRESULT: 0x80131018)
at System.Data.Entity.Migrations.MigrationsDomainCommand.Execute(Action command)
Could not load file or assembly 'EnvDTE, Version=126.96.36.199, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The module was expected to contain an assembly manifest.
I try to copy the "Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PublicAssemblies\EnvDTE.dll" to the project bin folder, but it dosen't work
If anyone help me?
Jun 4, 2013 at 11:14 AM
Edited Jun 4, 2013 at 12:35 PM
i ran into the same issue.
I had a Contracts component and a DAL component referencing the EF and Contracts component.
DAL.dll -> Contracts.dll
Due to a dependency of a Oracle component in my DAL i had to change my platform target to x64.
I finally does following process:
- Checked my dependencies in Contracts.dll and DAL.dll.
- Removed unneeded dependencies.
- Close my solution.
- Delete all output (bin\Debug or bin\Release) folders
- Start Solution.
- Set DAL project as Startup Project.
- Enter under package manager console: Enable-migrations
Hope it helps.
I finally realized that it depends of the current output folder of your project.
When changing the target platform to x64
the output folder also changes to
This seemed to be a problem for the enable-migrations cmdlet.
After changing the output folder back to bin\Debug
for a x64 platform build everything works fine.