aspnetcore: Can't load Microsoft.AspNetCore.Hosting 1.1.0.0
In the course of trying to help the EF Core team verify that a bug I’d run across was fixed in v1.1, I updated a functioning solution to both EF Core 1.1 and AspNet Core 1.1.
And I really, really, wish I hadn’t.
First off, my previously-functioning MVC6 site stopped working, complaining about a version mismatch on Microsoft.Logging.Abstractions (I think it involved not being able to find v1.0.0 of that assembly).
So I figured I’d just revert everything back to where it was before I did the test for the EF Core team. That should fix everything, right?
Wrong.
Now I’m getting the following:
System.IO.FileLoadException was unhandled Message: An unhandled exception of type ‘System.IO.FileLoadException’ occurred in Unknown Module. Additional information: Could not load file or assembly ‘Microsoft.AspNetCore.Hosting, 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)
Here’s the project.json file for the MVC6 app:
{
"userSecretsId": "aspnet-ConnellCampaigns-ddb1a50a-eba1-4870-91d4-4d26457f64ce",
"dependencies": {
"AutoMapper": "5.1.1",
"BundlerMinifier.Core": "2.2.296",
"ConnellData": "1.0.0-*",
"ConnellDataCore": "1.0.0-*",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Azure.WebJobs": "1.1.2",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.1",
"Microsoft.EntityFrameworkCore.SqlServer.Design": "1.0.1",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.Extensions.Caching.Memory": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.WindowsAzure.ConfigurationManager": "3.2.3",
"Serilog": "2.3.0",
"Serilog.Extensions.Logging": "1.2.0",
"Serilog.Sinks.Literate": "2.0.0",
"Serilog.Sinks.RollingFile": "3.2.0",
"UploadFramework": "1.0.0-*",
"WindowsAzure.Storage": "7.2.1"
},
"tools": {
"BundlerMinifier.Core": "2.0.238",
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"imports": [
"portable-net45+win8"
]
}
},
"frameworks": {
"net46": {
"frameworkAssemblies": {
"System.IO.Compression": "4.0.0.0"
},
"dependencies": {
}
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": [
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
]
},
"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
}
}
I’d appreciate help in getting me back to my paying work 😃. Also advice on how to diagnose this kind of problem in the future (other than never, ever, ever offering to test things 😃).
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 22 (4 by maintainers)
Commits related to this issue
- Mark Flaky http.sys tests Internal/#1826 — committed to dotnet/aspnetcore by Tratcher 5 years ago
- Mark Flaky http.sys tests Internal/#1826 (#8890) — committed to dotnet/aspnetcore by Tratcher 5 years ago
You might have stray binaries \ app.config in your bin directory. Does wiping the bin directory and rebuilding work?
I had the similar problem for Microsoft.AspNetCore.Http.Features package and I fixed it by adding assembly redirect into app.config:
Alternatively I resolved this problem by removing Microsoft.VisualStudio.Web.BrowserLink.Loader v14.1.0 package (which depends on Microsoft.AspNetCore.Http.Features). But I didn’t want that since I want browser link feature.
For whom still getting the Microsoft.AspNetCore.Http.Features / Microsoft.AspNetCore.Server.Kestrel[13] error below, on VS 2015.
Try uncheck “Enable Browser Link” at visual studio and set UseBrowserLink() on Startup.cs.
You will need also reference “Microsoft.VisualStudio.Web.BrowserLink.Loader” at project.json.
That’s works for me, probably is a Visual Studio issue.
@hikalkan I had the same issue with Microsoft.AspNetCore.Http.Features as well. I resolved it by replacing Microsoft.VisualStudio.Web.BrowserLink.Loader v14.1.0 with Microsoft.VisualStudio.Web.BrowserLink v1.0.0
I started using VS 2017 RC. The default template of ASP.NET MVC Core is working properly. If the project uses the Individual accounts (Identity + EF) the problem occurs. It was working properly initially with all V 1.0.0 Core packages. However, after upgrading all packages to 1.1.0 It seems that the Web.BrowserLink.Loader v14.1.0 or other packages) uses an old reference to old Features 1.0
LOG: Post-policy reference: Microsoft.AspNetCore.Http.Features, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 LOG: Attempting download of new URL file:///d:/doc/visual studio 2017/Projects/WebApplication4/src/WebApplication4/bin/Debug/net462/Microsoft.AspNetCore.Http.Features.DLL. WRN: Comparing the assembly name resulted in the mismatch: Minor Version ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.
Thanx, Brennan and Prana, for the quick replies. Brennan, I didn’t check out your suggestion because Prana’s approach solved the problem. But I’ll definitely keep it in mind for the future.
Clearing the bin directory did fix the problem. The app’s config file had a lot of references to later versions of assemblies that it shouldn’t have contained after I regressed the app. But what confuses me is that I did a “Clean Solution” and Rebuild before asking for help, because I’ve seen similar problems caused by cruft. I thought “Clean Solution” wiped out the contents of the bin directory…but it didn’t in this case (I checked). I had to delete the directory contents manually. Apparently, the behavior of Clean changed somewhere along the way.