Quick post about fixing Entity Framework, probably common error when you want to use ef for the first time e.g. you installed Visual Studio on new pc, fresh os, new project etc. and want to make dotnet-ef migrations or database update.
Error message:
“dotnet-ef : The term ‘dotnet-ef’ 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.”
Fix, you could run this command in Package Manager Console:
dotnet tool install --global dotnet-ef
Or you can install Microsoft.EntityFrameworkCore.Tools package from NuGet Package Manager.
Sample success message after use above command:
“You can invoke the tool using the following command: dotnet-ef
Tool ‘dotnet-ef’ (version ‘5.0.8’) was successfully installed.”