·您现在的位置: 云翼网络 >> 文章中心 >> 网站建设 >> 网站建设开发 >> ASP.NET网站开发 >> MVC4学习之官方教程中迁移版本库报错

MVC4学习之官方教程中迁移版本库报错

作者:佚名      ASP.NET网站开发编辑:admin      更新时间:2022-07-23

因工作需要,学习MVC4,但是微软官方教程中迁移版本库步骤在本地测试报错

官方教程地址:http://www.asp.net/mvc/overview/older-versions/getting-started-with-aspnet-mvc4/adding-a-new-field-to-the-movie-model-and-table

PM> Enable-Migrations -ContextTypeName MvcMovie.Models.MovieDBContext

错误提示
使用“8”个参数调用“CreateInstanceFrom”时发生异常:“Could not load file or assembly 'EntityFramework, Version=5.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. 系统找不到指定的文件。”
所在位置 F:\PRogramming\NET\MvcMovie\packages\EntityFramework.5.0.0\tools\EntityFramework.psm1:431 字符: 31
+ $domain.CreateInstanceFrom <<<< (
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : DotNetMethodTargetInvocation

解决方法:
先执行 Install-Package EntityFramework
再执行 Enable-Migrations -ContextTypeName MvcMovie.Models.MovieDBContext