question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Could not load file or assembly Microsoft.Extensions.Configuration.Abstractions, Version=3.1.0.0...

See original GitHub issue

I have a Visual Studio 2019 extension that references Microsoft.Extensions.Configuration v3.1.1.

This assembly gets loaded by a code generator and then that generator fails with the following error:

Could not load file or assembly Microsoft.Extensions.Configuration.Abstractions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60 or one of its dependencies. The system cannot find the file specified.

Notice that the version is 3.1.0.0, not 3.1.1.0 as I was expecting.

I’ve download the Microsoft.Extensions.Configuration package from nuget.org just to see if there was something wrong with the version of the package download by our build servers. If I open Microsoft.Extensions.Configuration.dll in ILSpy I see that the reference to Microsoft.Extensions.Configuration.Abstractions.dll is indeed to version 3.1.0.0.

The problem is that the package depends on version 3.1.1, which means that it is version 3.1.1.0 of Microsoft.Extensions.Configuration.Abstractions.dll that gets deployed in my extension, breaking assembly resolution.

Is this a bug in the NuGet package?

How can I work around it in the mean time?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:36 (15 by maintainers)

github_iconTop GitHub Comments

8reactions
icr8ivecommented, May 5, 2020

@anurse I can see that you have closed this thread but the problem still remains in a scenario where I cannot see that it has been addressed above. I’ve also followed issue #3213 (please do correct me here if I missed the proposed solution for this).

What is the recommendation for solving the following scenario which generates very much the same type of issue:

net standard 2.0 class libraries where the following dlls are referenced directly or indirectly

Microsoft.Extensions.DependencyInjection Microsoft.Extensions.DependencyInjection.Abstractions Microsoft.Extensions.Logging Microsoft.Extensions.Logging.Abstractions Microsoft.Extensions.Http

The problem occurs whith the following combination

  • Referencing any version higher than 3.1.0.0.
  • These net stadnard 2.0 Libraries are referenced in 3rd party application: Python application referencing these libraries, where in this case all related assemblies are added to predefined folder in python project.

System.IO.FileNotFoundException: Could not load file or assembly ‘Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60’ or one of its dependencies.

Having referenced 3.1.3.0 previously for the class libraries, it now has been downgraded to 3.1.0.0 to make this work. This workaound prevent currently to upgrade libraries to latest and greatest version keeping up with improvements and possibly new features.

.net core related project, as of my understanding, will automatically be able to reference higher versions wihout a need for bindingRedirect whereas using .net framework bindingRedirect would be needed. Here we have a 3rd party application in Python loading these class libraries and having the version problem on Microsoft.Extensions.DependencyInjection.Abstractions.

How to you suggest to solve this case?

6reactions
jason-dalycommented, Apr 15, 2020

@Pilchie Your suggested workaround will not work in our case - our .NET ‘app’ is an add-in to a third-party application and we cannot edit that application’s binding redirects. Why does Microsoft.Extensions.DependencyInjection v3.1.3 have a runtime dependency on Microsoft.Extensions.DependencyInjection.Abstractions v3.1.0? When will this be resolved? Could you fix this for us by providing a publisher policy assembly?

(“Dll Hell” is here to stay)

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - Could not load file or assembly Microsoft.Extensions. ...
I noticed in the error the Microsoft.Extensions.DependencyInjection.Abstractions 2.0.0 version was requested. Downgraded to that package in ...
Read more >
Could not load file or assembly 'Microsoft.Extensions. ...
Hello, I am on v3.x assemblies and trying to load swagger.json. However I am getting Could not load file or assembly 'Microsoft.Extensions.
Read more >
Azure Function Could not load file or assembly ...
I noticed that the error is resolved if I lower the version of "Microsoft.NET.Sdk.Functions" to "3.0.3", since from "3.0.4" it throws this error....
Read more >
"Could not load file or assembly 'Microsoft.Identity.Client ...
Identity.Client, Version=4.44.0.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae'." error whilst trying to use ExchangeOnlineManagement v3.
Read more >
Upgrade my Azure Function from .net Core 3.1 to . ...
System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=7.0.0.0, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found