I am posting this question just in case the solution I found would help someone else out. While working in Visual Studio 2017 rc4
each time I tried to run the Add-Migration
command in the Package Manager console I get the following error:
The term 'Add-migration' is not recognized...
Add-Migration - The Term 'Add-Migration' Is Not Recognized After creating models and context class, we nomally add migration to initialize the database. The error occurs sometimes while adding migration in asp.net core, entity framework with code first approach because of some missing library.
Add-Migration: Creates a new migration class as per specified name with the Up() and Down() methods. Update-Database: Executes the last migration file created by the Add-Migration command and applies changes to the database schema.
Adding a Migration So, firstly, you need to create a migration. Open the Package Manager Console from the menu Tools -> NuGet Package Manager -> Package Manager Console in Visual Studio and execute the following command to add a migration.
From the Tools menu, select NuGet Package Manager > Package Manager Console. The enable-migrations command creates a Migrations folder in the ContosoUniversity project, and it puts in that folder a Configuration. cs file that you can edit to configure Migrations.
The solution that worked for me after trying a whole raft of other solutions posted, was to:
Manage Nuget Packages
Include prerelease
check box Microsoft.EntityFrameworkCore.Tools
N.b that aspnetcore project in visual studio 2017 do not seem to have the project.json
file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With