As can be found several places, an Azure Function is not always deployed with all dependencies to Azure – apparantly because Microsoft has added a list of “standard” libraries/packages that should always be available on the Azure platform
This results in a nasty error
Could not load file or assembly ‘System.Configuration.ConfigurationManager, Version=5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’. The system cannot find the file specified.”:”System.Configuration.ConfigurationManager, Version=5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35″}
The solution is to use the undocumented property _FunctionsSkipCleanOutput like this in the .csproj file
.. removed ..
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AzureFunctionsVersion>v3</AzureFunctionsVersion>
<_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
</PropertyGroup>
.. removed ..
I my case, a used library System.Runtime.Caching was using the System.Configuration.ConfigurationManager library, and the latter was left out when deployed
This was on Microsoft.NET.Sdk.Functions (3.0.9)