ASP.NET Core EF Add-Migration 命令不起作用 [英] ASP.NET Core EF Add-Migration command not working
问题描述
按照这个微软教程 当我运行 PM> 时;从同一教程创建的 VS2015 项目中的 Add-Migration MyFirstMigration
命令出现以下错误,但无法解决:
Following this Microsoft Tutorial when I run the PM> Add-Migration MyFirstMigration
command in VS2015 project created from the same tutorial I get the following error that I can't resolve:
发现不止一个 DbContext.指定使用哪个.
将-Context"参数用于 PowerShell 命令和dotnet 命令的--context"参数.
More than one DbContext was found. Specify which one to use.
Use the '-Context' parameter for PowerShell commands and the '--context' parameter for dotnet commands.
注意事项
- 我正在使用上述教程,但我使用的是
Individual User Account
身份验证而不是教程中使用的No Authentication
. - 我有最新版本的
ASP.NeT Core 1.0 和 VS2015-Update 3 on windows 8.1
- 这是一个新创建的项目.没有手动安装其他 DbContext
- I'm using the above tutorial with the exception that I'm using
Individual User Account
authentication instead ofNo Authentication
used in the tutorial. - I've latest release of
ASP.NeT Core 1.0 and VS2015-Update 3 on windows 8.1
- This is a freshly created project. No other DbContext was manually installed
推荐答案
运行以下命令(获取自 这篇文章)和@Maverik 的回复(来自 StackOverflow 这里) 和上面@doctor 的建议帮助我解决了这个问题.谢谢大家的帮助:
Running the following command (obtained from this article) and a response from @Maverik (from StackOverflow here) and a suggestion from @doctor above helped me resolved the issue. Thank you all for your help:
PM> Add-Migration MyFirstMigration -Context BloggingContext
这篇关于ASP.NET Core EF Add-Migration 命令不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!