2017-10-18 36 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