I am deploying a .NET Core 3.1 Console app as an Application Package to execute jobs through Azure's batch service.

When I attempt to execute the job, the execution fails with the following error:

```
Unhandled exception. System.IO.FileNotFoundException: The configuration file 'appsettings.json' was not found and is not optional. The physical path is '/mnt/batch/tasks/workitems/FeedUpdates_Prod/job-1/FeedUpdate-20200107_1/wd/appsettings.json'.
   at Microsoft.Extensions.Configuration.FileConfigurationProvider.HandleException(ExceptionDispatchInfo info)
   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
   at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load()
   at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
   at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
   at Microsoft.Extensions.Hosting.HostBuilder.BuildAppConfiguration()
   at Microsoft.Extensions.Hosting.HostBuilder.Build()
   at App.jobs.Program.Main(String[] args) in C:\Development\app\app\app.jobs\Program.cs:line 24
Aborted (core dumped)

```

Here is the code where I am setting up the host and instructing it to use the json file (note that it gets the same error whether the config.SetBasePath line is called or not).

```
        public static IHostBuilder CreateHostBuilder(string[] args)
        {
            return Host.CreateDefaultBuilder(args)
                .ConfigureAppConfiguration((hostingContext, config) =>
                {
                    config.SetBasePath(Directory.GetCurrentDirectory());
                    config.AddJsonFile(
                       "appsettings.json", optional: false, reloadOnChange: false);
                    config.AddCommandLine(args);
                })
                .ConfigureWebHostDefaults(webBuilder =>
                {
                    webBuilder.UseStartup<Startup>();
                });

        }

```

The appsettings.json file is included in the application package I uploaded but is not present in the directory it's looking in ('/mnt/batch/tasks/workitems/FeedUpdates\_Prod/job-1/FeedUpdate-20200107\_1/wd/appsettings.json') so the message is accurate but I'm unclear as to why it's looking in that particular folder or how to tell it to look in the application's folder.

This is the command being executed to fire the job:

```
/bin/sh -c $AZ_BATCH_APP_PACKAGE_app_jobs"/app.Jobs -jFeedUpdate" 

```

[File Listing Showing appsettings.json](https://i.stack.imgur.com/DmUS3.png)