Unable to Enable EF6 Migrations in Visual Studio 2015 Web API project

In my VS2015 ASP.NET 5 Web API project I installed EF6.1.3 but the enable-migrations command in Package Manage console gives me following error: The term 'enable-migrations' is not recognized as the name of a cmdlet, function, script file, or operable program. None of the suggestions here work for me - giving me still the same error

UPDATE

So far, I've tried the following commands and have closed/re-open the VS (even as administrator):

Install-Package EntityFramework -IncludePrerelease

Update-Package –reinstall EntityFramework

Install-Package EntityFramework.Commands -Pre

Answers


Have you tried the following:

Install-Package EntityFramework -IncludePrerelease

I had the same issue recently.


EntityFramework.Commands is designed for EF7 and is not compatible with EF6. It's no wonder 'enable-migrations' is missing because this is not a command in EF7.

You can also try manually adding the EF module. All nuget does to import the commands is execute a small powershell file. You can do this yourself by manually finding and importing EntityFramework.psd1. See https://entityframework.codeplex.com/SourceControl/latest#src/NuGet/EntityFramework/tools/init.ps1

Import-Module C:\MySolution\packages\EntityFramework.6.1.3\tools\EntityFramework.psd1

In theory NuGet should do this automagically anytime it opens, but with ASP.NET 5 tooling, the project model has changed and their may be nuget bugs in VS. Have you upgraded to the latest nuget tooling (v3.3.0)? https://dist.nuget.org/index.html


I used the solution from this answer

You need to uninstall and then install the EntityFramework again. Just in case the uninstall failed because the EntityFramework used by other package as dependency, use command below to force the uninstall process.

Uninstall-Package -f EntityFramework


Need Your Help

Limited In-App Purchases

android timer google-play google-play-services in-app-billing

I've implemented in-app billing to my app but I want to make it a little different. I want to create purchase for example: unlock this item for 2 months. When I want to end the purchased item licen...

Can Reactive Extensions (Rx) be used across process or machine boundaries?

c# .net system.reactive

Vaguely remember seeing some discussions on this quite a while back but haven't heard anything since. So basically are you able to subscribe to an IObservable on a remote machine?