Getting an error :Add-Migration : The term 'Add-Migration' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

Shyamali Mishra 0 Reputation points
2023-05-19T13:51:47.28+00:00

Tried trouble shooting , verfied DB context class. Reinstalled Vs after troubleshooting and getting answers saying there is a problem with package manager .

Entity Framework Core
Entity Framework Core
A lightweight, extensible, open-source, and cross-platform version of the Entity Framework data access technology.
736 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,690 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,858 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
9,478 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Hemant Dubey 20 Reputation points
    2023-10-17T07:09:47.1233333+00:00

    install Microsoft.EntityFrameworkCore.Tools from NuGet packages, then try to run Add-Migration on the package manager console. Hope it helps.

    4 people found this answer helpful.

  2. Ian Xue 36,336 Reputation points Microsoft Vendor
    2023-05-22T01:19:02.7+00:00

    Hi

    Add-Migration is part of Microsoft.EntityFrameworkCore.Tools. You can install the package from NuGet.

    dotnet add package Microsoft.EntityFrameworkCore.Tools --version 7.0.5
    

    https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Tools/

    Best Regards,

    Ian Xue

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    3 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.