How can I do an Entity Framework Core project and add a Migration in Visual Studio 2015 from nuget prompt?
The following is only applicable to dnx which was part of ASP.NET Core RC1. This has been replaced and is not applicable part of ASP.NET Core.
Answering your questions regarding the better way you're looking for to run the dnx command:
My dnx command was also giving the error.
The term 'dnx' is not recognized as the name of a cmdlet, function,
in both my Visual Studio package manager console and Windows powershell.
After much frustration I was able to resolve it.
Here are the steps I did to get it working
- Close all instances of Visual Studio
- Delete the .dnx folder in C:\Users\YOURUSERNAME\.dnx. Mine was well over 1 GB
- Open Visual Studio 2015. Create a new default template ASP.NET 5 Web Application. Build and run it. This will recreate the .dnx folder. Afterwards the folder size was nearly 600MB
- Open Powershell
Navigate to the .dnx bin directory
cd\cd users\YOURUSERNAME\.dnx\bin
Run the command
.\dnvm upgrade
If you an error message "execution of scripts is disabled on this system." then run the following command to give you permission first
Set-ExecutionPolicy RemoteSigned
Go Open Visual Studio. You will then be able to type the command dnx in both package manager console and powershell
dnx
and it will recognize it
You missed a step. From the documentation at the time that your beta 8 was active, the missing command would have been:
Install-Package EntityFramework.Commands -Pre
to make the migrations commands available in your project.
The Commands
were moved to a separate package, presumably to make the main framework more lightweight for production, where you can't use and don't need command line utilities.
Answer-Update-contributed-by-Warren: In Asp.net core 1.0.0-RC2 the relevant package is named Microsoft.EntityFrameworkCore.Tools
and it appears to be part of the ASP.Net Core Web application template making the original problem highly unlikely to occur unless someone actually damages their project.json. Command line "EF" migration commands should not be run from Package Manager Console, which is NOT a general environment for DOTNET commands.