Could not load file or assembly Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.1.0.0
Since you're using the project in a .net framework library, there's an issue with auto-generated binding redirects (might be resolved in the upcoming 15.3 update / 2.0 .net core CLI). To work around it, add this in your cpsroj
file (preferably before any <Import>
element for a .targets
file if present):
<PropertyGroup>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
</PropertyGroup>
This should force MSBuild to create / update a YourProject.dll.config
file containing the necessary binding redirects.
I Googled my exception below, and it brought me to this stakoverflow post.
System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Extensions.OptionsModel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' or one of its dependencies. The system cannot find the file specified.'
I had the relevant Binding Redirects but if I Delete all bin/obj folders it worked fine afterwards.
This is an old thread but I had a similar same issue after I updated my Azure function from dotnet core version 3 to 3.1.
Error message: Could not load file or assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=3.1.9.0
In this case you need to update the Azure function version to 'v3' in .proj file.