This post shows you How to fix "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."
At line:1 char:1
+ add-migration todo
+ ~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (add-migration:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
When you working with asp.net core entity framework, sometime you need too add new class to ApplicationDbContext class.
For example:
public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext(DbContextOptions<ApplicationDbContext> options)
: base(options)
{
}
public DbSet<Todo> Todo { get; set; }
}
Next, you run add-migration command to convert from class to table, if you get an error as shown above.
First, you need to install Microsoft.EntityFrameworkCore.Tools package from nuget
or you should update your Entity Framework to new version.
Right-clicking on your project, then select Manage Nuget Packages => Updates => select all packages, then upload it to new version.