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.

FileNotFoundException when using Serilog.Settings.Configuration in an Azure Function in .NET 6

See original GitHub issue

I created an Azure Function which is running on .NET 6. My Azure Function uses Serilog for logging and I’m using Serilog.Settings.Configuration to read log settings from the configuration.

When running the Function, I run into this exception:

System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.Extensions.DependencyModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.'

I do see that the Serilog.Settings.Configuration package has a dependency on Microsoft.Extensions.DependencyModel v3.0.0.0 but this might maybe conflict with .NET 6 ?

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
fgheyselscommented, Jan 11, 2022

I have worked around this for now by:

  • explicitly adding a dependency on the package Microsoft.Extensions.DependencyModel v6.0.0
  • specify this Property in my Function’s csproj file:
       <PropertyGroup>
		<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
	</PropertyGroup>
1reaction
fgheyselscommented, Feb 5, 2022

It’s a workaround but not a clean solution imho.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error loading Serilog from IConfiguration in Azure Function
I've run into this, and found that if I keep the Microsoft.NET.Sdk.Functions dependency on 3.0.03, it works fine, even using .net6 and Azure...
Read more >
Could not load file or assembly Microsoft.Extensions. ...
Azure Functions v4 net 6/ Serilog.AspNetCore 5.0.0. The Function runs just fine with Serilog.AspNetCore 4.2.0, which has a dependency to Serilog.Settings.
Read more >
Windows 10 .Net 6 or .Net 7 runtime getting error Could not ...
Windows 10 .Net 6 or .Net 7 runtime getting error Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=7.0.0.0.
Read more >
System.IO.FileNotFoundException: 'Could not load file or ...
I have an application in .net core. the application was running fine, but the error started coming after I installed.
Read more >
Thomas Ardal
Serilog and log4net are two very popular choices for logging messages from .NET applications. In this post, I'll show you how to configure...
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