因工作需要,學習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
新聞熱點
疑難解答