Summary: When EF Core is referenced in a project where Azure Durable Functions are used - brings Azure Webjobs 3.0.0-beta4 into picture - then Microsoft.Extensions.Configuration.Abstractions version is changing and as a consequence error will be thrown because the new - higher - version of Microsoft.Extensions.Configuration.Abstractions cannot be loaded.
Steps to reproduce
Microsoft.Azure.WebJobs.Extensions.DurableTask Version="1.2.0-beta3"Microsoft.NET.Sdk.Functions Version="1.0.10"local.settings.json (example in the linked github repo)Microsoft.Extensions.Configuration.Abstraction 2.0.0 is referenced
http://localhost:7071/api/test/get url (based on the example I provided) then the whole stuff works fine.DbContext because you would like to communicate with your database, you would like to use EntityFramework Core.Microsoft.EntityFrameworkCore.Relational references the Microsoft.Extensions.Configuration.Abstractions version 2.0.1
Microsoft.Extensions.Configuration.Abstractions version from 2.0.0 to 2.0.1
{$ProjDir}/bin/Debug/netstandard2.0/bin directory
Azure function is able to communicate databases via EntityFramework Core.
Listening on http://localhost:7071/
Hit CTRL-C to exit...
Http Functions:
Function1_HttpStart: http://localhost:7071/api/test/get
[3/22/2018 10:04:56 PM] Job host started
[3/22/2018 10:05:06 PM] Function started (Id=dfebf871-4835-45a7-a8c9-f3a07342a9cd)
[3/22/2018 10:05:06 PM] Executing 'Function1_HttpStart' (Reason='This function was programmatically called via the host APIs.', Id=dfebf871-4835-45a7-a8c9-f3a07342a9cd)
[3/22/2018 10:05:06 PM] A ScriptHost error has occurred
[3/22/2018 10:05:06 PM] Exception while executing function: Function1_HttpStart. FunctionApp1: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
[3/22/2018 10:05:06 PM] Exception while executing function: Function1_HttpStart
[3/22/2018 10:05:06 PM] Exception while executing function: Function1_HttpStart. FunctionApp1: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
[3/22/2018 10:05:07 PM] Function completed (Failure, Id=dfebf871-4835-45a7-a8c9-f3a07342a9cd, Duration=591ms)
[3/22/2018 10:05:07 PM]
[3/22/2018 10:05:07 PM] Executed 'Function1_HttpStart' (Failed, Id=dfebf871-4835-45a7-a8c9-f3a07342a9cd)
[3/22/2018 10:05:07 PM] System.Private.CoreLib: Exception while executing function: Function1_HttpStart. FunctionApp1: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
[3/22/2018 10:05:07 PM] Function had errors. See Azure WebJobs SDK dashboard for details. Instance ID is 'dfebf871-4835-45a7-a8c9-f3a07342a9cd'
[3/22/2018 10:05:07 PM] System.Private.CoreLib: Exception while executing function: Function1_HttpStart. FunctionApp1: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=2.0.1.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
I'm not aware of.
I tried so far:
Microsoft.Extensions.Configuration.Abstractions Version="2.0.1" as separate nuget package to Function1 project, but it dod not help.I originally reported this at Azure Functions Durable Extensions project, but it turned out it is related rather to webjobs than durable functions.
Ultimately this looks like it's the result of https://github.com/Azure/azure-functions-host/issues/992.
@fabiocav -- should adding a direct nuget reference have helped here?
We should be able to move all nugets forward which will help temporarily, but if any dependency moves forward again this will happen again.
Workaround for my case is downgrading EF Core packages to 2.0.1 which references Microsoft.Extensions.Configuration.Abstractions - 2.0.0. It works fine. As temporary solution it is fine for a while.
I was seeing the same issues with "Microsoft.Extensions.Configuration.Abstractions, Version=2.0.1.0"
For me this occurred when using the
"Microsoft.Extensions.Configuration.Binder v2.0.1" and "Microsoft.Extensions.Configuration.EnvironmentVariables v2.0.1"
I could resolve it by downgrading both to v2.0.0 like @SayusiAndo described. Thanks for now!
Also have this same issue trying to use 3.0.0-beta5, with Microsoft.Extensions.DependencyInjection v2.0.0 results in
Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. Could not find or load a specific file. (Exception from HRESULT: 0x80131621). System.Private.CoreLib: Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
Tried referencing the package directly, same result.
When will this issue be resolved? Can't really have restrictions on upgrading EFCore because of this. It's the second issue within Azure "things", I have a similar issue within Azure Functions, there is another issue they don't seem to resolve, see: https://github.com/Azure/azure-functions-vs-build-sdk/issues/107
Would really appreciate an overview of what packages can be used with what, I know there are a lot of combinations but if some have restrictions then at least, your team internally and us, can know what the 'latest possible version' is.
I can imagine forgetting about this, upgrading EFCore or something else and come within the same problem again with other packages, this kind of creates a 'fear up upgrading' which should be avoided at all times.
Most helpful comment
When will this issue be resolved? Can't really have restrictions on upgrading EFCore because of this. It's the second issue within Azure "things", I have a similar issue within Azure Functions, there is another issue they don't seem to resolve, see: https://github.com/Azure/azure-functions-vs-build-sdk/issues/107
Would really appreciate an overview of what packages can be used with what, I know there are a lot of combinations but if some have restrictions then at least, your team internally and us, can know what the 'latest possible version' is.
I can imagine forgetting about this, upgrading EFCore or something else and come within the same problem again with other packages, this kind of creates a 'fear up upgrading' which should be avoided at all times.