I’ve been seeing “Update-Database Not Recognized” a lot lately when doing Code-First projects. Fortunately, the workaround is simple. I have seen cases where this solution isn’t permanent but must be executed every time Visual Studio is opened.

Steps to Produce Error

Create a new Visual Studio Solution (VS2013, VS2015 or VS2017), add a couple .Net Framework projects with one as a Domain or Entity object library then a second as your Entity Framework Data Access library; with the latest Entity Framework Nuget package. Add your DbSet() methods to your DbContext object then run ‘enable-migrations’ followed by ‘update-database’ from within your Package Management Console. All that and you may get this error.

The Error

“The term ‘update-database’ is not recognized as the name of a cmdlet, function, script file, or operable program.”

Entity Framework Update-Database Not Recognized

Essentially, the EntityFramework.psm1 file didn’t load and needs to be imported manually. This file is located in the packages > Entity Framework folder after installed using Nuget.

Entity Framework PowerShell Module

The Solution

Within Visual Studio and using the Package Management Console import the Entity Framework PowerShell module by using the import-module cmdlet.