aspnetcore: The term 'add-migration' is not recognized as the name of a cmdlet

It getting very annoying and I dunno so far what cases what but: every time I close Visual Studio 2015 and restart it opening same project again I can`t add migration with error

add-migration : The term ‘add-migration’ is not recognized as the name of a cmdlet, function, script file, or operab le program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again . At line:1 char:1

  • add-migration 16072016
  • - CategoryInfo          : ObjectNotFound: (add-migration:String) [], CommandNotFoundException
    - FullyQualifiedErrorId : CommandNotFoundException
    
    

I have in tools “Microsoft.EntityFrameworkCore.Tools”: “1.0.0-preview2-final”,

and in dependencies “Microsoft.EntityFrameworkCore.SqlServer”: “1.0.0”, “Microsoft.EntityFrameworkCore.Tools”: { “version”: “1.0.0-preview2-final”,

It every time.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 3
  • Comments: 23 (5 by maintainers)

Commits related to this issue

Most upvoted comments

Found

1 down vote

I had the same problem and found that it was a Visual Studio versioning problem in the Solution file.

I was targeting:

VisualStudioVersion = 14.0.25123.0

But I needed to target:

VisualStudioVersion = 14.0.25420.1

After making that change directly to the Solution file, EF Core cmdlets started working in the Package Manager Console.