Can't enable migrations for Entity Framework on VS 2017 .NET Core
EF Core does not have Enable-Migrations
command anymore. Migrations are enabled "by default". Add new migration with Add-Migration
.
Documentation about package manager commands is here
I had a similar issue with Visual Studio 2017 and a imported project from VS 2015, EF Migrations was no longer working.
After reading through the documentation on GitHub: https://github.com/aspnet/EntityFramework/issues/7031
I installed through Nuget this package:
"Microsoft.EntityFrameworkCore"
It caused a cascade effect of multiple downloads/installs. After the install, and restarting VS 2017, Everything is now back to normal.
Two days later, with another Visual Studio 2015 project, I had the same issue, and resolved it following the above procedure, but then I got this new error:
"Inheritance security rules violated by type: 'System.Net.Http.WebRequestHandler'. Derived types must either match the security accessibility of the base type or be less accessible."
I resolved this error by upgrading the project Framework to the latest ".NET Framework 4.6.2" (Scary.... but it worked without any further issues)
I referred to this documentation on GitHub: https://github.com/dotnet/corefx/issues/11100
I just installed Microsoft.EntityFrameworkCore.Tools
, then I tried to execute enable-migrations
then I got the following message in VS2017:
Enable-Migrations is obsolete. Use Add-Migration to start using Migrations.
Hope it helps.