PMC EF commands error: Unrecognized command or argument 'C#'

Nnr 30 Reputation points

In Visual Studio's Package Manager Console (V, the command

get-migrations, and other Entity Framework commands, output:

Specify --help for a list of available options and commands.

Unrecognized command or argument 'C#'

I have successfully run this and other EF commands through the PMC within the last week. But, seemingly all of a sudden, these commands produce the above two-line output. I have installed EF V6.4.4, verified in PMC by Get-Package and Get-Help about_EntityFramework.

I am using ASP.NET MVC 5, not Core.

Any ideas as to what might be causing this?

Microsoft Technologies based on the .NET software framework.
3,320 questions
A set of technologies in the .NET Framework for building web applications and XML web services.
3,231 questions
{count} votes

Accepted answer
  1. Piotr Glowala 95 Reputation points

    I have the same problem - Unrecognized command or argument 'C#' after Add-Migration command.

    Problem on newest VS 2022 (17.7). Problem also starts after update VS2019 to newest version 16.11.29 (before update everything was working great on VS2019).

    Everything works on different machine with VS2019 16.11.27

    1 person found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Kev Ritchie 11 Reputation points

    There is a way to get around this until a fix is released and won't require a reinstall of Visual Studio.

    If you run your commands in Verbose mode from the PMC e.g. Add-Migration "Name of Amendment" --verbose, you will see that for the --language parameter, C# is being output twice.

    You can copy that string out and then remove the second C# from the language parameter, paste it back into the PMC and run it.

    It will then create your migration script. Note, you may need to manually add the migration script to the Migrations folder in your solution via Add->Existing Item and select the 3 files that make up the migration script.

    To update the database, run Update-Database --verbose, copy out the string as above and remove the second C# and then paste back into the PMC and run.

    2 people found this answer helpful.

  2. Mike 0 Reputation points

    So did this just never get an answer? Any response at all after the requested info was provided? I've just updated to VS 2022 v17.9.1 and I'm getting this error constantly!

    Microsoft Visual Studio Community 2022
    Version 17.9.1
    Microsoft .NET Framework
    Version 4.8.09032
    Installed Version: Community
    ASP.NET and Web Tools
    ASP.NET and Web Tools
    Azure App Service Tools v3.0.0
    Azure App Service Tools v3.0.0
    Azure Functions and Web Jobs Tools
    Azure Functions and Web Jobs Tools
    C# Tools   4.9.0-3.24081.11+989117396f26e5453ff157df610d22ce45b6b0a9
    C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
    Common Azure Tools   1.10
    Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
    Microsoft JVM Debugger   1.0
    Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
    NuGet Package Manager   6.9.1
    NuGet Package Manager in Visual Studio. For more information about NuGet, visit
    Progress Telerik UI for ASP.NET AJAX Extension   2023.2.809.64
    Progress® Telerik® UI for ASP.NET AJAX Extension
    Razor (ASP.NET Core)
    Provides languages services for ASP.NET Core Razor.
    SQL Server Data Tools
    Microsoft SQL Server Data Tools
    TypeScript Tools   17.0.30103.2001
    TypeScript Tools for Microsoft Visual Studio
    Visual Basic Tools   4.9.0-3.24081.11+989117396f26e5453ff157df610d22ce45b6b0a9
    Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
    Visual F# Tools   17.9.0-beta.23614.3+a521e1cd420beb56c15faf6836184fadd2b7937a
    Microsoft Visual F# Tools
    Visual Studio IntelliCode   2.2
    AI-assisted development for Visual Studio.
    Visual Studio Tools for Unity
    Visual Studio Tools for Unity