Sharing code between functions

In a C# script-based Function App, adding a new file to one of the functions will not make it available to other functions in the application.

To share code between functions, we will need to do the following two things:

  • Create a folder named Shared at the root level of a Function App, and add shared code files to this folder. The WebJobs SDK (that Azure Functions are based on) watches for any code changes in the Shared folder and makes sure that the changes are picked up by the functions.
  • Create #load directives to the specific location of the shared files in each function that references the shared code.
You can add other folders to the function's watch list by modifying the watchDirectories setting of the ...

Get Serverless computing in Azure with .NET now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.