Could not load file or assembly 'Microsoft.EntityFrameworkCore.SqlServer, Version=1.1.0.0' after upgrading to 1.1.0

7

I have a Asp.Net Core project targeting .NET 462 and it was working with Asp.Net Core version 1.0.1. After upgrading to "1.1.0" I got this error:

FileLoadException: Could not load file or assembly 'Microsoft.EntityFrameworkCore.SqlServer, Version=1.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from 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"
            }
        }
    }
},

When I take a look at on build output folder, I can see all the libraries in a proper version except "Microsoft.EntityFrameworkCore.SqlServer": Microsoft.EntityFrameworkCore.SqlServer

I think it is causing the problem. But I just can not figure out why the version is wrong? Is it because the nuget package has a wrong version inside?

dll
asp.net-core
entity-framework-core
asked on Stack Overflow Nov 20, 2016 by Skorunka František • edited Nov 20, 2016 by Skorunka František

2 Answers

12

Complete project references clean-up solved my problem.

  1. Delete all bin/obj folders
  2. Delete all project.lock.json files
  3. Delete local Nuget repository cache (computer one)
  4. Remove all references from project.json file and add only required ones (with the help of R#)
  5. nuget udpate, dotnet restore = project is running

When I'm thinking about it again, maybe only point 4 was important?

answered on Stack Overflow Nov 30, 2016 by Skorunka František • edited May 15, 2017 by Roman Marusyk
0

updated Pomelo.EntityFrameworkCore.MySql in .csproj file to the latest version 3.1.1 to fix issue.

answered on Stack Overflow Mar 12, 2020 by Bon Osonwanne

User contributions licensed under CC BY-SA 3.0