title: How do you include references to external assemblies in Azure Functions
body: <p>I tried the following:</p>
  
  <pre><code>using System;
  using Newtonsoft.Json
  using Newtonsoft.Linq
  
  public static void Run(string myEventHubMessage, out string document, TraceWriter log)
  {
      log.Verbose($"C# Event Hub trigger function processed a message: {myEventHubMessage}");
      dynamic jsonData = JObject.Parse(myEventHubMessage);
      document = jsonData;
  }
  </code></pre>
  
  <p>I get the following when I hit the "Save" button in Azure portal:</p>
  
  <blockquote>
    <p>2016-04-05T21:28:31  Welcome, you are now connected to log-streaming
    service. 2016-04-05T21:28:33.443 Script for function
    'ProbeEventHubTrigger' changed. Reloading. 2016-04-05T21:28:33.443
    Compiling function script. 2016-04-05T21:28:33.568 (2,22): error
    CS1002: ; expected 2016-04-05T21:28:33.568 (3,22): error CS1002: ;
    expected 2016-04-05T21:28:33.568 (2,7): error CS0246: The type or
    namespace name 'Newtonsoft' could not be found (are you missing a
    using directive or an assembly reference?) 2016-04-05T21:28:33.568
    (3,7): error CS0246: The type or namespace name 'Newtonsoft' could not
    be found (are you missing a using directive or an assembly reference?)
    2016-04-05T21:28:33.568 (8,24): error CS0103: The name 'JObject' does
    not exist in the current context 2016-04-05T21:28:33.568 Compilation
    failed.</p>
  </blockquote>
  
  <p>I also tried the following:</p>
  
  <pre><code>#r "Newtonsoft.Json"
  #r "Newtonsoft.Linq"
  using System;
  
  public static void Run(string myEventHubMessage, out string document, TraceWriter log)
  {
      log.Verbose($"C# Event Hub trigger function processed a message: {myEventHubMessage}");
      dynamic jsonData = JObject.Parse(myEventHubMessage);
      document = jsonData;
  }
  </code></pre>
  
  <p>In this case I get the following when I hit the "Save" button in the Azure portal:</p>
  
  <blockquote>
    <p>2016-04-05T21:35:36  Welcome, you are now connected to log-streaming
    service. 2016-04-05T21:35:38.428 Script for function
    'ProbeEventHubTrigger' changed. Reloading. 2016-04-05T21:35:38.428
    Compiling function script. 2016-04-05T21:35:38.571 (2,1): error
    CS0006: Metadata file 'Newtonsoft.Linq' could not be found
    2016-04-05T21:35:38.571 (8,24): error CS0103: The name 'JObject' does
    not exist in the current context</p>
  </blockquote>
  
  <p>It's not obvious from the documentation how to reference these assemblies. I see in one example the syntax is "using Newtonsoft.Json", but this doesn't appear to work in the portal. Any suggestions?</p>