如何解决无法在使用 Visual Studio for mac 的 .net core 2.1 项目中使用 add-Migration
我正在使用 Visual Studio for Mac 并拥有 .NET Core 2.1 项目。使用“Add-Migration”等任何迁移命令时出现问题,即发生以下错误:
**Add-Migration : The term ‘Add-Migration’ 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
+ Add-Migration dbupdates -Context applicationdbcontext
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Add-Migration:String) [],CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException**
任何线索可能是什么原因?
解决方法
此错误表示缺少一个包。
从 nuget 安装包 Microsoft.EntityFrameworkCore.Tools
。然后重新打开视觉工作室。
您可能缺少 nuget 包,如果情况并非如此,还要仔细检查 Visual Studio 中的 powershell 接口是否指向正确的项目(您希望 DbContext 对象存在并被定义)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。