0

j'ai essayé d'exécuter cette commande:CommandNotFoundException dans asp.net mvc 5 base de données migration

Enable-Migrations -ContextType ApplicationDbContext 

Et obtenir cette exception:

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, verify that the path is correct and try again. 
At line:1 char:1 
+ Enable-Migrations -ContextType ApplicationDbContext 
+ ~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : ObjectNotFound: (Enable-Migrations:String) [], CommandNotFoundException 
    + FullyQualifiedErrorId : CommandNotFoundException 

Je l'aide vs édition communautaire 2015. Redémarrer et l'exécuter en tant qu'administrateur n'a pas pu résoudre le problème. Et si je tente d'exécuter cette commande pour réinstaller Entity Framework:

Install-Package EntityFramework -IncludePrerelease 

Obtenir cette exception ainsi:

Install-Package : An error occurred while retrieving package metadata for 'Newtonsoft.Json.10.0.3' from source 'C:\Path\packages'. 
At line:1 char:1 
+ Install-Package EntityFramework -IncludePrerelease 
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 
    + CategoryInfo   : NotSpecified: (:) [Install-Package], Exception 
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand 

S'il vous plaît, Donnez-moi une solution.

Répondre

0

son cas type sensible

enable-migrations -contexttypename DBCONTEXT 

vous pouvez également voir les options disponibles à partir

get-help EntityFramework 
+0

Il n'a pas résolu le problème. La même erreur montre @Rahul –