79391260

Date: 2025-01-27 15:14:45
Score: 1
Natty:
Report link

For .Net8 debugging in isolated mode, you would to need to:

  1. Follow the instruction posted by @Amor.

  2. Copy local.setting.json file to your console app.

  3. Copy Program.cs file into your console app.

  4. Change your HostBuilder declaration as follow:

    var host = Host.CreateDefaultBuilder() .ConfigureAppConfiguration(app => { app.AddJsonFile("local.settings.json", optional: true, reloadOnChange: true) .AddEnvironmentVariables(); }) .ConfigureServices((context, services) => {//Your code here

    services.AddScoped<FunctionName>();
    

    }) .Build();

  5. To get access to any value in the json file you would need to append Values: to the variable name as follow:

    var clientID = context.Configuration.GetValue("Values:clientId");

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @Amor
  • Low reputation (1):
Posted by: Haithem