无法加载文件或程序集' Microsoft.EntityFrameworkCore.SqlServer,Version = 1.1.0.0'升级到1.1.0后

时间:2016-11-20 13:48:49

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

我有一个针对.NET 462的Asp.Net Core项目,它正在使用Asp.Net Core版本1.0.1。升级到" 1.1.0"我收到了这个错误:

  

FileLoadException:无法加载文件或程序集   ' Microsoft.EntityFrameworkCore.SqlServer,Version = 1.1.0.0,   Culture = neutral,PublicKeyToken = adb9793829ddae60'或其中一个   依赖。定位程序集的清单定义没有   匹配程序集引用。 (HRESULT异常:0x80131040)

project.json

"dependencies": {
    "AspNet.Mvc.TypedRouting": "1.2.0",
    "AutoMapper": "5.1.1",
    "AutoMapper.Extensions.Microsoft.DependencyInjection": "1.1.2",
    "BundlerMinifier.Core": "2.2.306",
    "JetBrains.Annotations": "10.2.1",
    "libphonenumber-csharp": "7.7.4",
    "Microsoft.AspNetCore.Authentication.Cookies": "1.1.0",
    "Microsoft.AspNetCore.Authentication.Facebook": "1.1.0",
    "Microsoft.AspNetCore.Authentication.Google": "1.1.0",
    "Microsoft.AspNetCore.Authentication.MicrosoftAccount": "1.1.0",
    "Microsoft.AspNetCore.Authentication.OpenIdConnect": "1.1.0",
    "Microsoft.AspNetCore.Authentication.Twitter": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics": "1.1.0",
    "Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.1.0",
    "Microsoft.AspNetCore.Mvc": "1.1.0",
    "Microsoft.AspNetCore.Razor.Tools": "1.1.0-preview4-final",
    "Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
    "Microsoft.AspNetCore.Server.Kestrel.Https": "1.1.0",
    "Microsoft.AspNetCore.Session": "1.1.0",
    "Microsoft.AspNetCore.StaticFiles": "1.1.0",
    "Microsoft.EntityFrameworkCore": "1.1.0",
    "Microsoft.EntityFrameworkCore.SqlServer": "1.1.0",
    "Microsoft.EntityFrameworkCore.Tools": "1.1.0-preview4-final",
    "Microsoft.Extensions.Configuration": "1.1.0",
    "Microsoft.Extensions.Configuration.Abstractions": "1.1.0",
    "Microsoft.Extensions.Configuration.CommandLine": "1.1.0",
    "Microsoft.Extensions.Configuration.EnvironmentVariables": "1.1.0",
    "Microsoft.Extensions.Configuration.Json": "1.1.0",
    "Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
    "Microsoft.Extensions.Logging": "1.1.0",
    "Microsoft.Extensions.Logging.Console": "1.1.0",
    "Microsoft.Extensions.Logging.Debug": "1.1.0",
    "Microsoft.Extensions.Options.ConfigurationExtensions": "1.1.0",
    "Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.1.0",
    "Microsoft.VisualStudio.Web.CodeGenerators.Mvc": "1.1.0-preview4-final",
    "MotleyFlash": "0.3.0",
    "MotleyFlash.AspNetCore.MessageProviders": "0.2.0",
    "MotleyFlash.AspNetCore.ViewHelpers": "0.2.0",
    "SendGrid.NetCore": "1.0.0-rtm-00002",
    "System.Interactive.Async": "3.1.0",
    "Twilio": "4.7.2"
},
"frameworks": {
    "net462": {
        "dependencies": {
            "TaxiGun.Server.IdentityServer.Data": {
                "target": "project"
            },
            "TaxiGun.Server.Services": {
                "target": "project"
            }
        }
    }
},

当我查看构建输出文件夹时,我可以看到所有库都在正确的版本中,除了" Microsoft.EntityFrameworkCore.SqlServer": Microsoft.EntityFrameworkCore.SqlServer

我认为这是导致问题的原因。但我只是想不通为什么版本错了?是因为nuget包里面有错误的版本吗?

2 个答案:

答案 0 :(得分:8)

完整的项目参考清理解决了我的问题。

  1. 删除所有bin / obj文件夹
  2. 删除所有project.lock.json文件
  3. 删除本地Nuget存储库缓存(计算机一)
  4. 从project.json文件中删除所有引用,并仅添加必需的引用(在R#的帮助下)
  5. nuget udpate,dotnet restore =项目正在运行
  6. 当我再次考虑它时,也许只有第4点很重要?

答案 1 :(得分:0)

将.csproj文件中的Pomelo.EntityFrameworkCore.MySql更新为最新版本3.1.1,以解决此问题。