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.
 
Exact Error
  1. PM> Add-Migration 'Intialize Database'  
  2. 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   
  3. path is correct and try again.  
  4. At line:1 char:1  
  5. + Add-Migration 'Intialize Database'  
  6. + ~~~~~~~~~~~~~  
  7.     + CategoryInfo          : ObjectNotFound: (Add-Migration:String) [], CommandNotFoundException  
  8.     + FullyQualifiedErrorId : CommandNotFoundException  
Solution
 
Simply install Microsoft.EntityFrameworkCore.Tools package from nuget:
 
Command
 
Install-Package Microsoft.EntityFrameworkCore.Tools -Version 3.1.6
 
You can also use this link to install the latest version: https://www.nuget.org/packages/Microsoft.EntityFrameworkCore.Tools/
 
Tips - Install the latest stable version.
 
Sometimes, the error persists because of cache, so restarting your visual studio can solve the issue without doing anything.