Current listing of EF packages in my project:
Id Versions ProjectName
EntityFramework.Core {7.0.0-rc1-final}
EntityFramework.MicrosoftSqlServer {7.0.0-rc1-final}
EntityFramework.Commands {7.0.0-rc1-final}
Yet when I try to add migrations in PowerShell using add-migration I get the following error:
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.
I've tried restarting visual studio/rebooting to no avail.
Can you provide a few more details? What kind of project are you using? Did nuget restore work correctly? Which version of Windows are you using?
OS: Windows 10
Framework: dnx451
VS: Visual Studio 2015 Communitiy Edition.
Solution: Regular Class library
Xproj does currently not support commands in Package Manager Console. To use migrations, you need to use the command line - https://docs.efproject.net/en/latest/platforms/aspnetcore/new-db.html#create-your-database.
Xproj has enabled support for the upcoming RC2 release, so you'll be able to use the commands when that is available.
Hi,
If you have received error like “the term ‘Add-Migration’ is not recognized as the name of a cmdlet, then close and reopen the visual studio.
After reopen the Visual Studio -> Open Package Manager Console
Type Update-Database and Enter
I had similar issues in VS 2013. What I did was to update my Package Manager Console, restarted VS and that fixed it for me.
Mine was working 2 days ago, now it's giving the "not recognized as name cmdlet, function ..." Error.
I had the same issue. I ran VS2015 as Administrator and it solved my issue
Try the following steps:
1) Remove all Microsoft.EntityFrameworkCore.Tools references from dependencies and tools sections inside a project.json
2) Close Package Manager Console (PMC) and restart Visual Studio
3) Add under dependencies section:
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
}
4) Add under tools section
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final"
5) Restart again Visual Studio 2015
6) Open the PMC and type
Add-Migration $Your_First_Migration_Name$
That's because the PMC recognize the tools when Visual Studio is starting.
In VS2017 same thing... RUN AS ADMINISTRATOR! 🗡
Hi, i'm trying to use the command enable-migration, but i am experiencing always the same error:
The term 'Enable-Migrations' is not recognized as the name of a cmdlet, function, script file, or operable program.
I tried all the possible solutions that you have proposed; no one of these solution worked.
i'm using VS2019
@NanuNic9379 The above thread is quite old. You don't need Enable-Migrations any more. See e.g. https://stackoverflow.com/questions/41403824/cant-enable-migrations-for-entity-framework-on-vs-2017-net-core
Note: as mentioned in the above you will need to install the Microsoft.EntityFrameworkCore.Tools package.
If you still can't use the other PowerShell commands, e.g. Add-Migration, try opening a new issue.
Most helpful comment
I had the same issue. I ran VS2015 as Administrator and it solved my issue