Azure Functions - More Tips!
Published Feb 12 2019 02:11 PM 325 Views
Iron Contributor
First published on MSDN on Jun 16, 2016

Authored by Jeffrey Chilberto

Referencing external assemblies and packages is a great feature of Azure Functions.  See the developer reference for context.

After some strange behavior using Azure Functions, Fabio Cavalcante (MSFT) gave me some insight into how multiple function triggers are hosted in the same resource.
Azure Functions are "currently loaded within the same process and app domain and although multiple versions are not generally a problem, as we'll load multiple versions side-by-side, you do need to exercise care and issues will come up if you have multiple versions (meaning different binaries) that have the same assembly name and version."

When referencing your own assemblies, here are two tips.  First, follow a good assembly versioning strategy.  Each release of the assembly should have a different assembly version.  Secondly, create a directory at the same level as the function directories that is shared.  For example,

You would then be able to reference the libraries as #r "..\common\MyLibrary.dll"

This will help to avoid ugly exceptions like
Exception while executing function: Functions.Function1. mscorlib: Exception has been thrown by the target of an invocation. ƒ-Function1#ℛ*a5b873d3-e5f5-419d-95c3-8992a7946ce3#17-0: Method not found:

Version history
Last update:
‎Feb 12 2019 02:11 PM
Updated by: