I just installed VS 2017 and created a new Core project. Inside it, I added:
I also created a folder called Models with a class in it. Then, I went to the Package Manager Console and executed enable-migrations so that VS will create the files needed for me. However, instead of the needed files, I got the following error.
The term 'enable-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.
What am I supposed to do here?
I seem to be out of luck googling. It's a very unusual combination (Core VS17 and EF) so there's virtually no info on the subject. Some guides talk about editing package.json by hand which is kind of hard because VS 2017 seems to upgrade the Core so that dotnet restore doesn't look for it but rather for a xxx.csproj.
In summary, I'm confused and quite uncertain how to bite the problem.
EF Core does not have
Enable-Migrations command anymore. Migrations are enabled "by default". Add new migration with
Documentation about package manager commands is here
As others mentioned before, enable migrations is obsolete and is turned on anyway, and you can use the Add-Migration InitialCreate.
I'll add that you do NOT need to add more packages to the project, as it will already reference the necessary assemblies in the Microsoft.AspNetCore.All metapackage.
You can also use your console (cmd/shell depending on your OS) instead of the PM power shell console. To do so, you need to add a reference to the dotnet tool: edit your project file (right click it and select 'edit .csproj' - and add the following reference in an ItemGroup:
<DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="2.0.0"></DotNetCliToolReference>
and then in the console type
dotnet ef migrations add InitialCreate