2

It seems there are many types, although certain projects only include one or two of them.

Create a new Function in Visual Studio preview, and it gives you a host.json and local.settings.json.

I've also seen projects with function.json and project.json.

The Function docs illustrate what function.json is for:

The function.json file defines the function bindings and other configuration settings. The runtime uses this file to determine the events to monitor and how to pass data into and return data from function execution.

An example:

{
    "disabled": false,
    "bindings": [
        // ... bindings here
        {
            "type": "bindingType",
            "direction": "in",
            "name": "myParamName",
            // ... more depending on binding
        }
    ]
}

host.json also has a purpose, per the Azure webjobs SDK:

In the root script directory, there should be a host.json metadata file that contains the global configuration options affecting all functions. The Script runtime will map these settings into their corresponding WebHobs SDK JobHostConfiguration settings when initializing the host.

So what does local.settings.json and project.json do?

Mikhail Shilkov
  • 34,128
  • 3
  • 68
  • 107
Dave Voyles
  • 4,495
  • 7
  • 33
  • 44

1 Answers1

4

local.settings.json is to store the application settings for your local development environment, see Local settings file. Production settings will be taken from Azure environment configuration.

project.json is to reference any custom NuGet packages that your function utilizes, see this answer.

Mikhail Shilkov
  • 34,128
  • 3
  • 68
  • 107
  • 1
    OK, so if my project is not utilizing any custom NuGet packages, then I will not need project.json. And local.settings.json is where I would store things like connection strings and such, correct? – Dave Voyles Jul 11 '17 at 15:10
  • @DaveVoyles-MSFT Feel free to delete `project.json`, it's optional. And yes - connection strings will go to `local.settings.json`. – Mikhail Shilkov Jul 11 '17 at 15:12
  • 1
    Perfect, thank you! I will mark this as correct as soon as it allows (5 min) – Dave Voyles Jul 11 '17 at 15:14