添加迁移命令在 UWP 应用程序的 EF 7 中不起作用
Add-Migration command not working in EF 7 for UWP app
我正在关注 getting started with EF 7 for UWP apps 官方教程。
当我在添加迁移 MyFirstMigration 时,它抛出以下错误:
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
有没有人想出任何解决方法?
干得好@Anil。 :)
其实,由于这种问题可能与Visual Studio工具或NuGet有关。通过在 GitHub 上的 EF 存储库中搜索 "CreateInstanceAndUnwrap Add-Migration",您会在那里看到一些 issues。如果你下次找不到任何存在的问题,就像我问的问题(project.json、项目类型等)一样,试着找出你的steps/configurations和教程之间有什么区别很有帮助,您将获得更多信息以获得快速答复。
相信@bricelam 已经指出了你遇到的问题,没有人比他更熟悉 EF7 了。我想从@bricelam 中挑选一些关键信息作为结尾:
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.
我正在关注 getting started with EF 7 for UWP apps 官方教程。
当我在添加迁移 MyFirstMigration 时,它抛出以下错误:
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
有没有人想出任何解决方法?
干得好@Anil。 :)
其实,由于这种问题可能与Visual Studio工具或NuGet有关。通过在 GitHub 上的 EF 存储库中搜索 "CreateInstanceAndUnwrap Add-Migration",您会在那里看到一些 issues。如果你下次找不到任何存在的问题,就像我问的问题(project.json、项目类型等)一样,试着找出你的steps/configurations和教程之间有什么区别很有帮助,您将获得更多信息以获得快速答复。
相信@bricelam 已经指出了你遇到的问题,没有人比他更熟悉 EF7 了。我想从@bricelam 中挑选一些关键信息作为结尾:
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.