Option 1 - the #r directive

To reference framework assemblies and a number of other commonly used assemblies, you can use the #r AssemblyName directive.

For instance, a Newtonsoft.Json library that we have used in the ScoreTweet function is one of the common libraries that can be referenced with an #r directive. If we were to deploy ScoreTweet as a C# script-based function, we would need to add the following line before the function code:

    #r "Newtonsoft.Json" 

The full function code using the #r directive will be provided in the Sharing code between functions section later in this chapter.

When using a privately developed assembly, you may add the assembly to your function's bin directory, and then reference it by using the full file name, ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.