添加依赖项并更新模型类后,使用EF 7运行应用程序时出错

时间:2015-08-06 00:52:57

标签: asp.net-core-mvc entity-framework-core

我正在运行MVC 6和EF 7并且已经更改了我的模型并希望运行该应用程序,但是我收到错误并且不清楚根本原因是什么。

下面的

是我的project.json

的片段
"dependencies": {
"EntityFramework.Commands": "7.0.0-beta5",
"EntityFramework.SqlServer": "7.0.0-beta5",
"Microsoft.AspNet.Antiforgery": "1.0.0-beta6",
"Microsoft.AspNet.Authentication.Cookies": "1.0.0-beta5",
"Microsoft.AspNet.Authentication.Facebook": "1.0.0-beta5",
"Microsoft.AspNet.Authentication.Google": "1.0.0-beta5",
"Microsoft.AspNet.Authentication.MicrosoftAccount": "1.0.0-beta5",
"Microsoft.AspNet.Authentication.Twitter": "1.0.0-beta5",
"Microsoft.AspNet.Diagnostics": "1.0.0-beta5",
"Microsoft.AspNet.Diagnostics.Entity": "7.0.0-beta5",
"Microsoft.AspNet.Identity.EntityFramework": "3.0.0-beta5",
"Microsoft.AspNet.Mvc": "6.0.0-beta5",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta5",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta5",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta5",
"Microsoft.AspNet.Session": "1.0.0-beta6",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta5",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta5",
"Microsoft.Framework.Configuration.Abstractions": "1.0.0-beta5",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta5",
"Microsoft.Framework.Configuration.UserSecrets": "1.0.0-beta5",
"Microsoft.Framework.Logging": "1.0.0-beta5",
"Microsoft.Framework.Logging.Console": "1.0.0-beta5",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta5"
},

以下是网页错误。

  

system.missingMethodException而   找不到方法:'Boolean Microsoft.Framework.DependencyInjection.ServiceCollectionExtensions.TryAdd(Microsoft.Framework.DependencyInjection.IServiceCollection,Microsoft.Framework.DependencyInjection.ServiceDescriptor)。       在Microsoft.Framework.DependencyInjection.LoggingServiceCollectionExtensions.AddLogging(IServiceCollection服务)       在Microsoft.AspNet.Hosting.WebHostBuilder.BuildHostingServices()       在Microsoft.AspNet.Hosting.WebHostBuilder.Build()       在Microsoft.AspNet.Loader.IIS.RuntimeHttpApplication.ApplicationStart(IHttpApplication应用程序)       在Microsoft.AspNet.Loader.IIS.HttpApplicationBase.InvokeApplicationStart(IHttpApplication application)

1 个答案:

答案 0 :(得分:5)

从一个测试版到另一个测试版有很多重大变化。

因此我建议您将project.json中的所有版本与beta5或beta6对齐。