【发布时间】:2017-12-15 09:11:52
【问题描述】:
我尝试运行这个命令:
Enable-Migrations -ContextType ApplicationDbContext
得到这个异常:
Enable-Migrations : The term 'Enable-Migrations' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1
+ Enable-Migrations -ContextType ApplicationDbContext
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Enable-Migrations:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我正在使用 vs 2015 社区版。重新启动并以管理员身份运行无法解决问题。如果我尝试运行此命令来重新安装实体框架:
Install-Package EntityFramework -IncludePrerelease
也得到这个异常:
Install-Package : An error occurred while retrieving package metadata for 'Newtonsoft.Json.10.0.3' from source 'C:\Path\packages'.
At line:1 char:1
+ Install-Package EntityFramework -IncludePrerelease
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
请给我任何解决方案。
【问题讨论】:
标签: asp.net asp.net-mvc entity-framework ef-code-first entity-framework-migrations