Skip to content

I can't find a way to set the environment to Development which injects the user secrect configuration source #10836

Open
@jotabe-net

Description

@jotabe-net

Type of issue

Missing information

Description

I'm trying to get the User Secrects configuraiton source included, as explained in this comment:

load app IConfiguration from User Secrets when EnvironmentName is 'Development' using the entry assembly

but I have no idea what this means:

is 'Development' using the entry assembly

Trying this:

  var builder = Host.CreateApplicationBuilder(new HostApplicationBuilderSettings
  {
      EnvironmentName = Environments.Development,
  });

has no effect. And setting directly the environment name, neither works:

builder.Environment.EnvironmentName = "Development";

I have no idea, and can't fin in the docuemntation, how to set the environment in a different way.

NOTE: I want to use this for a template using host, so, ideally, this should be done by copde, and not depend on some confiuration that can be changed or verwritten.

Thnak you!

Page URL

https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.hosting.host.createapplicationbuilder?view=net-9.0-pp

Content source URL

https://github.com/dotnet/dotnet-api-docs/blob/main/xml/Microsoft.Extensions.Hosting/Host.xml

Document Version Independent Id

f1673a77-ddda-383d-57a6-8403758c5271

Article author

@dotnet-bot

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions