ASP.NET Core EF Add-Migration命令不起作用 [英] ASP.NET Core EF Add-Migration command not working

查看:443
本文介绍了ASP.NET Core EF Add-Migration命令不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

遵循此 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.

要注意的地方

  1. 我正在使用以上教程,但我使用的是Individual User Account身份验证,而不是本教程中使用的No Authentication.
  2. 我拥有最新版本的ASP.NeT Core 1.0 and VS2015-Update 3 on windows 8.1
  3. 这是一个新创建的项目.没有其他手动安装的DbContext
  1. I'm using the above tutorial with the exception that I'm using Individual User Account authentication instead of No Authentication used in the tutorial.
  2. I've latest release of ASP.NeT Core 1.0 and VS2015-Update 3 on windows 8.1
  3. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆