I'm trying to run ef7 migration on fresh asp.net 5 preview project.
Steps I took:
Add-Migrationin Package Manager console
The term 'Add-Migration' is not recognized as the name of a cmdlet, function, script file, or operable program.
I also try this command:
Install-Package EntityFramework.Commands -Pre
I think for VS 2015 project is redundant, it executed but still Add-Migration was not recognized.
Thanks in advance for clues...
NuGet commands don't work with ASP.NET 5 projects. You'll need to use the ASP.NET 5 command-line versions of the commands. (E.g.
k ef migration add) We have an issue aspnet/DNX#952 open to unblock this scenario, but it hasn't seen much activity.
To learn more about the ASP.NET Commands, see my post EF7 Migrations: ASP.NET Commands.
Ok, I know this is an old question and it has already been technically answered. That is, if you want to open command prompt and do it. The root cause of this problem is that the PowerShell module is not initializing. There is a simple fix though. You just need to initialize the module. Go to your solution explorer. Go to References >> .NETCoreApp,Version=v1.0 then scroll down until you find Microsoft.EntityFrameworkCore.Tools right click and show the properties. Take note of the path it should be something like
Once you have that go to the path location in file explorer. You should see another folder called tools. Inside that folder you will see a .ps1 file called init.ps1. This is the module that we need to initialize. So go back to Visual Studio, I am using VS 2015 pro and Win 10 pro, open the package manager console. Type in the following
and press enter. Then to initialize a module in PowerShell you just need to type
or I believe you can just do the entire path and get the same results so that way would be
Unfortunately you would have to do this every time that error pops up, but its not that bad if you just save the path in a .txt file or comment it somewhere in your project that is easy to find.