升級到1.1.0後無法加載文件或程序集“Microsoft.EntityFrameworkCore.SqlServer,Version = 1.1.0.0”

asp.net-core dll 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包裡面有錯誤的版本嗎?

一般承認的答案

完整的項目參考清理解決了我的問題。

  1. 刪除所有bin / obj文件夾
  2. 刪除所有project.lock.json文件
  3. 刪除本地Nuget存儲庫緩存(計算機一)
  4. 從project.json文件中刪除所有引用並僅添加必需的引用(在R#的幫助下)
  5. nuget udpate,dotnet restore =項目正在運行

當我再次考慮它時,也許只有第4點很重要?



Related

許可下: CC-BY-SA with attribution
不隸屬於 Stack Overflow
許可下: CC-BY-SA with attribution
不隸屬於 Stack Overflow