ASP.NET dnx ef命令System.TypeInitializationException

时间:2016-01-30 22:23:46

标签: asp.net dnx

我有一个asp.net mvc6 proyect。

我在提示窗口上运行此命令。使用Code,我首先尝试创建数据库。我不明白我的错误或错误在哪里,或者我错过了一个图书馆

1- dnvm install 1.0.0-beta8 2- dnvm使用1.0.0-beta8 3- dnu恢复 4- dnx ef数据库更新(如果我运行dnx ef --help或dnx ef,则相同)

System.TypeInitializationException: Se produjo una excepción en el inicializador de tipo de 'Microsoft.Data.Entity.Commands.Program'. ---> System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.
   en Microsoft.Data.Entity.Commands.Program..cctor()
   --- Fin del seguimiento de la pila de la excepción interna ---
   en Microsoft.Data.Entity.Commands.Program..ctor()
System.NullReferenceException: Referencia a objeto no establecida como instancia de un objeto.
   en Microsoft.Data.Entity.Commands.Program..cctor()

我的Project.json

{
  "userSecretsId": "aspnet5-Cl.Web.MVC6-271ad9d8-3fda-4cc7-8188-e1c924f58554",
  "version": "1.0.0-*",
  "compilationOptions": {
    "emitEntryPoint": true
  },

  "dependencies": {
    "EntityFramework.Commands": "7.0.0-rc1-final",
    "EntityFramework.MicrosoftSqlServer": "7.0.0-rc1-final",
    "Microsoft.ApplicationInsights.AspNet": "1.0.0-rc1",
    "Microsoft.AspNet.Authentication.Cookies": "1.0.0-rc1-final",
    "Microsoft.AspNet.Authentication.Facebook": "1.0.0-rc1-final",
    "Microsoft.AspNet.Authentication.Google": "1.0.0-rc1-final",
    "Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-rc1-final",
    "Microsoft.AspNet.Authentication.Twitter": "1.0.0-rc1-final",
    "Microsoft.AspNet.Diagnostics.Entity": "7.0.0-rc1-final",
    "Microsoft.AspNet.Identity.EntityFramework": "3.0.0-rc1-final",
    "Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
    "Microsoft.AspNet.Mvc": "6.0.0-rc1-final",
    "Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-rc1-final",
    "Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final",
    "Microsoft.AspNet.StaticFiles": "1.0.0-rc1-final",
    "Microsoft.AspNet.Tooling.Razor": "1.0.0-rc1-final",
    "Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.FileProviderExtensions": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.Json": "1.0.0-rc1-final",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Console": "1.0.0-rc1-final",
    "Microsoft.Extensions.Logging.Debug": "1.0.0-rc1-final",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc1-final",
    "Sendgrid": "6.3.4"
  },

  "commands": {
    "web": "Microsoft.AspNet.Server.Kestrel",
    "ef": "EntityFramework.Commands"

  },

  "frameworks": {
    "dnx451": { },

  },

  "exclude": [
    "wwwroot",
    "node_modules"
  ],
  "publishExclude": [
    "**.user",
    "**.vspscc"
  ],
  "scripts": {
    "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
  }
}

1 个答案:

答案 0 :(得分:2)

您正在使用rc1 dnx beta8个软件包。升级到dnx rc1-final,它应该有效。