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

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

问题描述

按照这个微软教程 当我运行 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.

注意事项

  1. 我正在使用上述教程,但我使用的是 Individual User Account 身份验证而不是教程中使用的 No Authentication.
  2. 我有最新版本的 ASP.NeT Core 1.0 和 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

推荐答案

运行以下命令(获取自 这篇文章)和@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屋!

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