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

前端 未结 26 2957
渐次进展
渐次进展 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:12

    Make sure you are running Visual Studio as a administrator.

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

    In Visual Studio 2012 I had the same error. Had to uninstall NuGet (Tools > Extensions and Updates > Installed > All: NuGet Package Manager: Uninstall button). Then closed Visual Studio. Then reopened Visual Studio and reinstalled NuGet (Tools > Extensions and Updates > Online > Visual Studio Gallery: NuGet Package Manager: Download button). Then in following windows: click Install button, then click close button. Then close and reopen Visual Studio.

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

    I tried all of the above suggestions but nothing worked for me then I updated Nuget Package Manager and it worked..

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

    I had the same problem and I found that it is because of some characters in project path like [ or ] I correct the project path and it worked fine!

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

    I had the same issue with VS 2019 Preview, .Net Core, and EntityFramework Core.

    Turns out I had to install via NuGet Microsoft.EntityFrameworkCore.Tools and Microsoft.EntityFrameworkCore.Design. Once that was done, it worked like a charm.

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

    What fixed this symptom for me (VS2013) is uninstalling then reinstalling the EF package with Nuget. The difference in the csproj file changed this...

    <Reference Include="EntityFramework">
      <HintPath>..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.dll</HintPath>
    </Reference>
    

    ...into this...

    <Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
      <SpecificVersion>False</SpecificVersion>
      <HintPath>..\packages\EntityFramework.6.1.1\lib\net45\EntityFramework.dll</HintPath>
    </Reference>
    

    I don't fully understand why yet, but it worked at least.

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