Azure Function Apps – does not deploy all dependencies

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″}

For instance here and here

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)

Leave a Reply

Your email address will not be published.