'Azure Functions Errro - Could not load file or assembly System.Configuration.ConfigurationManager, Version=4.0.3.0

I am working on Azure Functions and these are created in .Net Core version 3.1 whereas the other libraries are written in .Net Framework 4.8. While executing the functions, I am getting following error -

System.Private.CoreLib: Exception while executing function: XXXXXX. System.Private.CoreLib: One or more errors occurred. (The type initializer for 'XXXXX' threw an exception.). XXXX.Service: The type initializer for 'XXXXX.Service.XXXXX' threw an exception. XXXX.Service: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.

Suggestions would be appreciated.



Solution 1:[1]

Make sure your package version exists. From this it seems that there is no package version in which you reported an error, check this link:

https://www.nuget.org/packages/System.Configuration.ConfigurationManager/5.0.0-preview.1.20120.5

Click Version History, and you will find:

enter image description here

Solution 2:[2]

You can work around the issue by adding the _FunctionsSkipCleanOutput to the project file.

<PropertyGroup>
  <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Cindy Pau
Solution 2 Chris Stubbs