2017-10-18 86 views
0
In package Manager Console, I type `enable-migrations`, The output shows error : 

    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 pa 
    th was included, verify that the path is correct and try again. 
    At line:1 char:18 
    + enable-migrations <<<< 
     + CategoryInfo   : ObjectNotFound: (enable-migrations:String) [], CommandNotFoundException 
     + FullyQualifiedErrorId : CommandNotFoundException 

I also try to install 

    PM> Install-Package EntityFramework -IncludePrerelease 
    Install-Package : The current environment doesn't have a solution open. 
    At line:1 char:16 
    + Install-Package <<<< EntityFramework -IncludePrerelease 
     + CategoryInfo   : InvalidOperation: (:) [Install-Package], InvalidOperationException 
     + FullyQualifiedErrorId : NuGetNoActiveSolution,NuGet.PowerShell.Commands.InstallPackageCommand 

    PM> 

the problem still exist. 

I am new to entity framework. Please help. 

Thank you very much. 

Cheers, 
newbuntu 


@TAHA SULTAN TEMURI, many thanks. I use run as administrator and 

Uninstall-Package EntityFramework -Force无法启用迁移在VS2013最终

结果是:

PM> Uninstall-Package EntityFramework -Force 
Uninstall-Package : The current environment doesn't have a solution open. 
At line:1 char:18 
+ Uninstall-Package <<<< EntityFramework -Force 
    + CategoryInfo   : InvalidOperation: (:) [Uninstall-Package], InvalidOperationException 
    + FullyQualifiedErrorId : NuGetNoActiveSolution,NuGet.PowerShell.Commands.UninstallPackageCommand 

PM> 

然后,我Install-Package EntityFramework

错误是:

PM> Uninstall-Package EntityFramework -Force 
Uninstall-Package : The current environment doesn't have a solution open. 
At line:1 char:18 
+ Uninstall-Package <<<< EntityFramework -Force 
    + CategoryInfo   : InvalidOperation: (:) [Uninstall-Package], InvalidOperationException 
    + FullyQualifiedErrorId : NuGetNoActiveSolution,NuGet.PowerShell.Commands.UninstallPackageCommand 

PM> Install-Package EntityFramework 
Install-Package : The current environment doesn't have a solution open. 
At line:1 char:16 
+ Install-Package <<<< EntityFramework 
    + CategoryInfo   : InvalidOperation: (:) [Install-Package], InvalidOperationException 
    + FullyQualifiedErrorId : NuGetNoActiveSolution,NuGet.PowerShell.Commands.InstallPackageCommand 

PM> 
+0

[包管理器控制台启用 - 迁移CommandNotFoundException只能在特定的VS项目]可能的副本(https://stackoverflow.com/questions/10411529/package-manager-console-enable-migrations-commandnotfoundexception-only-in- a-spe) – Riv

回答

0

杉杉牛逼运行此

卸载,包的EntityFramework -Force

然后

安装,包装的EntityFramework

然后重新以管理员身份。

+1

非常感谢。但问题仍然存在。 – newbuntu

+0

,我已经尝试所有帖子中的方法。他们都不能解决这个问题。 – newbuntu

+0

非常感谢女士们,先生们。我设法解决它。这是我作为新手所犯的一个错误:在不加载项目的情况下启用迁移。加载项目后,我设法启用它。许多人都感谢所有。这是我的无知导致了这个错误。干杯! – newbuntu