Skip to content

Print warning when AddJsonFile is called with "local.settings.json" #613

@anthonychu

Description

@anthonychu

Is it possible to somehow warn if someone tries to load local.settings.json like this? Maybe an analyzer?

        public static void Main()
        {
            var host = new HostBuilder()
                .ConfigureFunctionsWorkerDefaults()
                .ConfigureAppConfiguration((context, config) =>
                {
                    config.AddJsonFile("local.settings.json", optional: true);
                })
                .Build();

            host.Run();
        }

There's no reason to do this. Locally, Core Tools already loads the settings from that file into the environment. In Azure, we don't want customers using local.settings.json. They should be using App Settings.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions