title: How to get the FunctionAppDirectory in Configure(IWebJobsBuilder builder) in Azure function
body: <p>In Azure function i can get the FunctionAppDirectory from the context but How do I get the FunctionAppDirectory  in Configure method.</p>
  
  <p>I need FunctionAppDirectory at <code>&lt;&lt;FunctionAppDirectory&gt;&gt;</code> in the code:</p>
  
  <pre><code>// --------------------------------------------------------------------------------------------------------------------
  // &lt;copyright file="WebJobsExtensionStartup.cs" company="Microsoft"&gt;
  // Copyright (c) Microsoft Corporation. All rights reserved.
  // &lt;/copyright&gt;
  //  --------------------------------------------------------------------------------------------------------------------
  
  using System;
  using System.Collections.Generic;
  using System.Globalization;
  using System.IO;
  using System.Linq;
  using System.Text.RegularExpressions;
  using Intercom.Helpers;
  using Microsoft.ApplicationInsights.Extensibility;
  using Microsoft.Azure.KeyVault;
  using Microsoft.Azure.Services.AppAuthentication;
  using Microsoft.Azure.WebJobs;
  using Microsoft.Azure.WebJobs.Hosting;
  using Microsoft.Extensions.Configuration;
  using Microsoft.Extensions.Configuration.AzureKeyVault;
  using Microsoft.Extensions.DependencyInjection;
  using Microsoft.Extensions.Logging;
  
  [assembly: WebJobsStartup(typeof(ConvAi.BfChannel.BotManagementService.WebJobsExtensionStartup), "Web Jobs Extension")]
  namespace ConvAi.BfChannel.BotManagementService
  {
      /// &lt;summary&gt;
      /// WebJobsExtensionStartup
      /// So this Azure function should be deployed with App service plan.
      /// &lt;/summary&gt;
      public class WebJobsExtensionStartup : IWebJobsStartup
      {
          /// &lt;summary&gt;
          /// AzureServiceTokenProvider which is used for requesting identity token.
          /// &lt;/summary&gt;
          public static AzureServiceTokenProvider AzureServiceTokenProvider { get; set; }
  
          /// &lt;summary&gt;
          /// Configure services.
          /// &lt;/summary&gt;
          /// &lt;param name="builder"&gt;WebJob Builder&lt;/param&gt;
          public void Configure(IWebJobsBuilder builder)
          {
              try
              {
                  bool isLocal = string.IsNullOrEmpty(Environment.GetEnvironmentVariable("WEBSITE_INSTANCE_ID"));
  
                  // Gets the default configuration
                  var serviceConfig = builder.Services.FirstOrDefault(s =&gt; s.ServiceType.Equals(typeof(IConfiguration)));
                  var rootConfig = (IConfiguration)serviceConfig.ImplementationInstance;
  
  
                  var config = new ConfigurationBuilder()
                      .SetBasePath(&lt;&lt;FunctionAppDirectory&gt;&gt;)
                      .AddConfiguration(rootConfig)
                      .AddJsonFile($@"Config\botregistrationOptions.{rootConfig["environmentName"]}.json", optional: false)
                      .Build();
  
                  // Replace the existing config
                  builder.Services.AddSingleton&lt;IConfiguration&gt;(config);
  
              }
              catch (Exception ex)
              {
                  //log
                  throw;
              }
          }
      }
  }
  </code></pre>