dotnet / dotnet/dotnet-api-docs
I can't find a way to set the environment to Development which injects the user secrect configuration source
- Dominant language
- C#
- Stars
- 949
- Forks
- 1.7k
- Avg merge
- 3d 27m
- Merged PRs (30d)
- 49
Description
### 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](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.configuration.iconfiguration?view=net-9.0-pp) from User Secrets when [EnvironmentName](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.hosting.ihostenvironment.environmentname?view=net-9.0-pp#microsoft-extensions-hosting-ihostenvironment-environmentname) is 'Development' using the entry assembly
but I have no idea what this means:
> is 'Development' using the entry assembly
Trying this:
```csharp
var builder = Host.CreateApplicationBuilder(new HostApplicationBuilderSettings
{
EnvironmentName = Environments.Development,
});
```
has no effect. And setting directly the environment name, neither works:
```csharp
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
Contributor guide
Assessment
This issue has not been assessed yet.