Jhorra
Jhorra

Reputation: 6321

Unrecognized option '-Context' when running dotnet ef command

Starting a new project, and trying to set up the database for authentication. I run the following command in powershell. dotnet ef database update -Context ApplicationDbContext and get the following error Unrecognized option '-Context'

So I try running it without the -Context option just to see and get:

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.

I also tried running it with --context instead of -context, but get the same error. Any suggestions on why it recognizes that I need that option, but at the same time tells me it doesn't recognize the option?

I also restart powershell.

Upvotes: 1

Views: 7229

Answers (2)

humblefool_9
humblefool_9

Reputation: 89

I was having the same problem and instead of using dotnet ef database update -Context ApplicationDbContext, I replaced -Context with -c which worked for me.

Upvotes: 0

traveler3468
traveler3468

Reputation: 1656

Instead of using --context ApplicationDbContext have you tried -c ApplicationDbContext https://learn.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet#aspnet-core-environment

Upvotes: 6

Related Questions