Package Manager Console Enable-Migrations CommandNotFoundException only in a specific VS project

前端 未结 26 2958
渐次进展
渐次进展 2020-11-28 06:55

I tried to run the command \'Enable-Migrations\' in a new project and I got the message:

PM> Enable-Migrations
The term \'Enable-Migrations\' is not recog         


        
相关标签:
26条回答
  • 2020-11-28 07:24

    I reinstalled with the commmand: Install-Package EntityFramework -IncludePrerelease and the problem went away.

    0 讨论(0)
  • 2020-11-28 07:24

    None of these solutions worked for me. My solution was to delete packages/EntityFramework.6.1.3 and Restore NuGet Packages

    I noticed that packages/EntityFramework.6.1.3/tools/EntityFramework.psd1 was missing, so this was a likely cause. How it got removed in the first place though I have no clue.

    0 讨论(0)
  • 2020-11-28 07:25

    Restarting Visual Studio with administrator privilege solved the issue for me.

    0 讨论(0)
  • 2020-11-28 07:26

    In .NET Core, I was able to reach the same resolution as described in the accepted answer, by entering the following in package manager console:

    Install-Package EntityFramework.Core -Pre
    
    0 讨论(0)
  • 2020-11-28 07:26

    downgrade to 6.2 helped me.
    .NET Framework version 4.6.1
    Project in old format(non .NET Standard)
    Visual Studio should be open with Admin rights for initial migration.
    I guess EF with version above 6.2 require latest .NET Framework.

    0 讨论(0)
  • 2020-11-28 07:27

    I had multiple projects in the solution, but I had the correct Default Project set, so I thought it should work.

    In the end, I had to add the -StartupProject MyProjectName option to the command

    0 讨论(0)
提交回复
热议问题