ASP.NET Core EF Add-Migration命令不起作用 [英] ASP.NET Core EF Add-Migration command not working
问题描述
遵循此 Microsoft教程在从同一教程创建的VS2015项目中运行PM> 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 and 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
推荐答案
运行以下命令(从此处),上面@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屋!