6

I have a project targeting framework of .net6.0. I want to upgrade to ef 7.0.0 from ef6.0.0. In my solution, I have a separate project for functionApps. There I am getting an error "Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=7.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.".

As I have to upgraded to ef 7.0.0, all the dependencies should be at 7.0.0. As per this link, Could not load file or assembly 'Microsoft.Extensions.Configuration.Abstractions, Version=5.0.0.0 in Azure Functions, I cannot downgrade the version. Below is the function app error screenshot.

FunctionApp Error

ouflak
  • 2,458
  • 10
  • 44
  • 49
ispostback
  • 330
  • 2
  • 7
  • 23
  • Have you tried to add a reference manually? `dotnet add package Microsoft.Extensions.Configuration.Abstractions --version 7.0.0` maybe there is already another reference to this one in another project. – Hille Dec 15 '22 at 13:26
  • Yes @Hille , I have added both the packages Entity Framework and Configuration.Abstractions of stable version 7 manually using .NET CLI Global Cmdlets - Giving the host errors on starting of the Function. But working excellently with the version 6 of both the packages. –  Dec 15 '22 at 13:29
  • I think that I had the same problem, my solution was a upgrade to .net 7, but it's probably only feasible if you in development stage and not production. – Hille Dec 15 '22 at 13:32
  • Yes .NET 7 is not yet released for Azure Functions except isolated version. –  Dec 15 '22 at 13:34
  • It is working for .NET 7 as shown practically [here](https://stackoverflow.com/a/74473381/16630138) but when we remove the package called `Microsoft.NET.Sdk.Functions` –  Dec 15 '22 at 13:35
  • Runtime errors mean the correct DLLs weren't deployed along with the application. How *did* you deploy it? Did you include all the contents of the `bin/Release/.../publish` folder? – Panagiotis Kanavos Dec 15 '22 at 14:52
  • @HariKrishna, it is not possible to remove `Microsoft.NET.Sdk.Functions` in my case – ispostback Dec 16 '22 at 06:07
  • @ispostback, Got it. For that, I have raised the product issue in the GitHub which needs to be fixed from backend (MSFT Azure Team). Will follow up. –  Dec 16 '22 at 06:16

2 Answers2

12
  • This issue is registered in the Azure Functions Host GitHub Repository where the Function is throwing the NuGet Package load exception with Version 7 of Entity Framework Core and Microsoft.Extensions.Configuration.Abstractions which have been released recently.

  • A few users mentioned it is working with Version 6 NuGet Packages installed in .NET 6 v4 Azure Functions and also for .NET 7 with the removal of the specific package Microsoft.NET.Sdk.Functions as shown practically in the same SO Forum of Azure Functions, .NET 7 In-Process is not yet release for Azure Functions which will be released soon.

  • You can track this GitHub Azure Functions Host Issue 8984 for the .NET 6 v4 NuGet (EF Core & Config.Abstractions Versioned 7) Packages Runtime Issue and will update the answer with the fix accordingly.

Kevin
  • 16,549
  • 8
  • 60
  • 74
Pravallika KV
  • 2,415
  • 2
  • 2
  • 7
3

I encountered the same issue and I resolved it by downgrading "Microsoft.Extensions.Http" to 6.0.0.0 to match my TargetFramework net6.0

Changes to csproj file

enter image description here