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

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 recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verif
y that the path is correct and try again.
At line:1 char:18
+ Enable-Migrations <<<< 
    + CategoryInfo          : ObjectNotFound: (Enable-Migrations:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

But in all other projects the command runs just fine.

Why is this happening?

BTW, I'm using VS2010 Professional SP1

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

Answers


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


Just simply re-starting Visual Studio worked for me. No need to install packages, etc.


First "Install-Package EntityFramework -IncludePrerelease" and then Restarting Visual Studio as a Administrator worked for me together.


Make you are running Visual Studio as a administrator.


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


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.


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!


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.


In VS 2013, try to install the UPDATE 1(RC1) and the problem is resolved.


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


Need Your Help

Hashcodes are same, but != returns true?

c# c#-4.0

I am stumped by a seemingly simple problem. I have two objects that I am comparing with a !=.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.