18

I am deploying a function and I am able to build and publish it successfully in a function app V2 from Visual studio, but in the azure portal I see the below message inside my function app. I have added the necessary package but still its of no use. Has anyone come across this error and have any feedback. There is no error in the Output window of Visual studio as well.

If I remove this version of abstraction then it says file not found with version 3.1.5. When i add the version 3.1.5 then it says file not found. No clue what is wrong. there is a discussion in github but that thread is closed now without much information

Thanks

System.Private.CoreLib: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb97829ddae60'. The system cannot find the file specified. System.Private.CoreLib: Could not load the specified file.

Ankit Kumar
  • 476
  • 1
  • 11
  • 38
  • This issue is starting to pop up more that .net 5 is released. Here's the reference in documentation - https://learn.microsoft.com/en-us/dotnet/core/compatibility/aspnetcore#extensions-package-reference-changes-affecting-some-nuget-packages. It also documents the recommended actions. – Gary Chan Nov 13 '20 at 17:30

5 Answers5

20

I have just come across a similar issue. For me the problem was I had included one of the Microsoft.Extensions.xxx packages with Version="5.0.0" but my target framework was netcoreapp3.1.

Changing the version of the referenced extension package to the same as my target framework resolved the error.

E.g.

Change:

<PackageReference Include="Microsoft.Extensions.Http" Version="5.0.0" />

To:

<PackageReference Include="Microsoft.Extensions.Http" Version="3.1.10" />

The real problem was I ran dotnet add package Microsoft.Extensions.xxx without specifying the version so it just added the latest available.

mfa
  • 601
  • 6
  • 19
  • 2
    GitHub issue: https://github.com/Azure/azure-functions-core-tools/issues/2304 Like mentioned in one comment, it's interesting that 5.0.0 packages don't work although they claim to support .NET Standard 2.0. – Kim Mar 12 '21 at 14:45
  • thank you for your solution, solved the issue – codebrane Feb 01 '22 at 12:33
2

I fixed it by changing the Function runtime version. It was set to ~2 . I changed it to ~3 and that made the error go away.

You can do it in Function App -> Configuration -> Function runtime

Ankit Kumar
  • 476
  • 1
  • 11
  • 38
1

I had the issue too, The changed the version to 2.1.1 and it works for me.

Chamath Jeevan
  • 5,072
  • 1
  • 24
  • 27
0

I was able to solved it installing via nuget package, the package that was causing the error Microsoft.Extensions.xxx and then specifying the version of the package in the .csproj as the same that is the target framework, in my case 3.1; then i changed the xml property AzureFunctionsVersion in .csproj file from v2 to v3

.csproj

0

Unload project and edit/change a sdk function version. In my case i change to last version:

Example:

<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="4.1.1" />