I'm following getting started with EF 7 for UWP apps official tutorial.
When I'm at Add-Migration MyFirstMigration, it throws following error:
PM> Add-Migration MyFirstMigration
Add-Migration : Exception calling "CreateInstanceAndUnwrap" with "8" argument(s): "Could not load file or assembly 'AppShellProject, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'
or one of its dependencies. An attempt was made to load a program with an incorrect format."
At line:1 char:1
+ Add-Migration MyFirstMigration
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Add-Migration], MethodInvocationException
+ FullyQualifiedErrorId : BadImageFormatException,Add-Migration
Has anyone figured out any workaround?
Great job @Anil. :)
Actually, since this kind of issue may be related to Visual Studio tools or NuGet. By searching "CreateInstanceAndUnwrap Add-Migration" in EF repository on GitHub, you will see some issues there. If you cannot find any existing issues next time, as same as the questions(project.json, project type and etc. ) I asked, try to find out what's the difference between your steps/configurations and the tutorial will be helpful and you will have more info to get a quick answer.
I believe @bricelam has pointed out the issue you encountered, and no one is more familiar with EF7 than him. I want to pick some key messages from @bricelam in that issue as the ending:
Correct, the Migration commands won't work with x64 assemblies. The current implementation executes inside of an AppDomain created from VS (devenv.exe) which is a 32-bit process.
you'll have to use x86 at design-time.