Application startup exception: System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions
Hi, i'm compiling an asp.net core application running on net461, if i compile it on a CI machine with just vs2017 15.5.4 build tools installed, the output fails with that exception. When i compile that project on any other machine (dev, with the whole vs2017 installed) the output works correctly. I think the assembly in the error is just one of many failing.
It tries to load version 1.1.0 of the assembly while the build process output the correct 2.0 version, i have no idea where to look! the .deps.json file does not mention that version, nor does the app.config fiile.
This is problem with the autofac library targeting netstandard1.0
Why it works on some machines and does not no a clean one with just build tools ? Autofac and Autofac.Extensions.DependencyInjection both target netstandard1.1, not netstandard 1.0. Netstandard 2.0 should be backward compatible with netstandard 1.x, is'nt it ? And how do you diagnose the problem and solve it ? Thanks
YES. Do you have the sdk on the build server.
I would really like to learn how to diagnose this problems, can you point me where you see the problem in the exception or dep.json file pls ?
Yes the sdk is there

The buildtools don't package the sdk if I remember rightly so you must have installed the sdk manually on the build agent.
As you can see it's all there

THANKS. OnTmsTrasportatori.Web is attempting bind to 1.1.0 and fighting major version mismatch.Im still interested the autofac lib is the culprit which I mentioned earlier and you say it runs the host from vs, Can you test on the published output. also check references locally.
I don't know if it's the same issue, i tried that repro and it gives a different exception :
Unhandled Exception: System.MissingMethodException: Method not found: 'System.IServiceProvider Microsoft.Extensions.DependencyInjection.ServiceCollectionContainerBuilderExtensions.BuildServiceProvider(Microsoft.Extensions.DependencyInjection.IServiceCollection)'. at Library.Startup.Build(IServiceCollection services) at ConsoleApp2.Program.Main(String[] args) in c:\Users\vborioni\Desktop\Repros-BuildServiceProvider\ConsoleApp2\Program.cs:line 13
I'm using it without ConfigureContainer. Thanks for helping @dallancarr but i do not understand what you meant by :
THANKS. OnTmsTrasportatori.Web is attempting bind to 1.1.0 and fighting major version mismatch.Im still interested the autofac lib is the culprit which I mentioned earlier and you say it runs the host from vs, Can you test on the published output. also check references locally.
In my folder Microsoft.Extensions.DependencyInjection.Abstractions is correctly 2.0, but looks like autofac wants 1.1, why does it happen ? shouldn't deps.json file avoid this ? this is taken from the deps.json file
"Autofac.Extensions.DependencyInjection/4.2.0": {
"dependencies": {
"Autofac": "4.6.1",
"Microsoft.Extensions.DependencyInjection.Abstractions": "2.0.0",
"NETStandard.Library": "2.0.0"
},
"compile": {
"lib/netstandard1.1/Autofac.Extensions.DependencyInjection.dll": {}
}
Just wanted you to assure me it is building correctly outside vs on your local compared to the build agent.
I'm sorry i do not yet have a repro i can share, but i would really like to learn a process to diagnose this, not going trial and error, i would like to read something, understand what's wrong and then act 😄
Fixed by updating signalr from
<PackageReference Include="Microsoft.AspNetCore.SignalR.Http" Version="1.0.0-alpha1-26873" />
to
<PackageReference Include="Microsoft.AspNetCore.SignalR" Version="1.0.0-preview1-final" />
Microsoft.AspNetCore.SignalR i just kept pealing out pieces of application until it worked... i wish i was able to diagnose what the problem was 😞
And i have a repro, i know the problem is solved, the package was preview etc... but i would like to learn how to diagnose those problems 😄 maybe @davidfowl can point me in the right path Autofac_dependency.zip