I\'m new to ASP.NET and am trying to set up a webAPI c# application with entity framework. But when I try to run the Enable-Migrations command on nuget-package-manager conso
I had this error when using EntityFramework 6.3.0, downgrading it to 6.2.0 fix my issue.
There is a workaround for this bug. Just edit a file and restart Visual Studio. It works!
Issue is due to not having sufficient privileges to run the command. Open Visual studio in administrator mode (Run as Administrator) and execute the command.
I had same error and just update EF to latest version (Here to 6.4.0) Now migrations works well.
update-package entityframework
enable-migrations
Add-Migration InitialCreate
I get this if I have my database code in a separate class library. To get the commands to work I had to select the class library as the start up project.
So I did the following...
Select the project where the database context exists and right click, select "Set as StartUp Project".
Select the default project as the correct project.
Ensure that you are in the project directory on the filesystem.
Run the commands.
Just use any of the versions of EntityFramework except 6.3.0. In my case using EntityFramework 6.0.0 solved the problem.