Le terme de “complément de Migration” n'est pas reconnu

Je suis en utilisant ce MSDN Tutoriel à exécuter dans VS2015 la commande PM> Add-Migration MyFirstMigration -context BloggingContext qui a couru hier avec succès, mais aujourd'hui, il donne l'erreur suivante, qui est également souligné par d'autres utilisateurs ici. J'ai même supprimé les Migrations dossier depuis l'explorateur de solutions et la db correspondant de SQL Express 2014 on Win 8.1 mais même erreur. Même si je Add-Migration MyFirstMigration j'obtiens la même erreur:

Add-Migration : The term 'Add-Migration' 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
+ Add-Migration MyFirstMigration -context BloggingContext
+ ~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Add-Migration:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Note: je suis en utilisant la dernière version de ASP.NET Core 1.0 et VS2015 - mise à Jour 3 publié le 27 juin 2016.

Mise à JOUR

Les commandes suivantes fonctionnent bien à partir du répertoire du projet dans l'explorateur de windows lors de l'utilisation de la fenêtre de commande:

> dotnet ef migrations add MyFirstMigration --context BloggingContext
> dotnet ef database update --context BloggingContext

Mise à JOUR 2a

Suivant est le projet.fichier json:

{
  "userSecretsId": "aspnet-ASPCore_RTM_CodeFirst_test-bef835d9-9831-41a8-bc3a-cd2f1477a880",

  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
    "Microsoft.AspNetCore.Diagnostics": "1.0.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
    "Microsoft.AspNetCore.Mvc": "1.0.0",
    "Microsoft.AspNetCore.Razor.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
    "Microsoft.EntityFrameworkCore.SqlServer.Design": {
      "version": "1.0.0",
      "type": "build"
    },
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
    "Microsoft.Extensions.Configuration.Json": "1.0.0",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
    "Microsoft.Extensions.Logging": "1.0.0",
    "Microsoft.Extensions.Logging.Console": "1.0.0",
    "Microsoft.Extensions.Logging.Debug": "1.0.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    },
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
      "version": "1.0.0-preview2-final",
      "type": "build"
    }
  },

  "tools": {
    "BundlerMinifier.Core": "2.0.238",
    "Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
    "Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
    "Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final",
    "Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
      "version": "1.0.0-preview2-final",
      "imports": [
        "portable-net45+win8"
      ]
    }
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "Views",
      "Areas/**/Views",
      "appsettings.json",
      "web.config"
    ]
  },

  "scripts": {
    "prepublish": [ "bower install", "dotnet bundle" ],
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}
  • Merci de ne pas les trucs les balises dans le titre
  • veuillez écrire votre projet.json je veux voir vos paquets
  • selon votre demande, j'ai ajouté une mise à JOUR 2 dans mon post pour ajouter la section pertinente de peoject.fichier json. S'il vous plaît laissez-moi savoir si vous avez besoin de plus d'info
  • Vous avez obtenu une réponse de @briceIam (équipe EF) je pense qu'il fonctionne!
  • J'ai ajouté de l'ensemble du contenu du projet.fichier json dans la mise à JOUR 2 de l'article de mon post. Veuillez voir mes commentaires dans la réponse de @bricelam. Ce que j'ai peut-être manquant?
  • Pour le bénéfice des chercheurs, j'ai résolu un problème similaire par la fermeture de TOUTES les instances de Visual Studio et de commencer à nouveau de retour. Peut sauver quelqu'un d'un peu plus de temps.
  • Ce problème devrait être résolu après la fermeture de Visual Studio. Reportez-vous à ce liendocs.microsoft.com/en-us/ef/core/get-started/aspnetcore/new-db Creating Database pour plus d'informations.
  • comment faire pour voir le projet.json, je suis dans VS2017 et d'avoir le même problème

InformationsquelleAutor nam | 2016-07-03