Skip to content

Set the environment in a command shell when the app is run #38002

Open

Description

@Albirair

Description

The command provided in the documentation sets an environment variable with the name "Staging" to the empty string.
dotnet run -e Staging
since .NET CLI uses -e|--environment option to set environment variables not the environment itself. However, we can use -e to set DOTNET_ENVIRONMENT :
dotnet run -e DOTNET_ENVIRONMENT=Staging
or ASPNETCORE_ENVIRONMENT :
`

Image

`

Page URL

https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments?view=aspnetcore-10.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/fundamentals/environments.md

Document ID

1cb5eb30-dd84-e5e1-5826-d74243fabf04

Platform Id

3f914b6e-befc-c9a2-7712-d34a12a97fec

Article author

@guardrex

Metadata

  • ID: ceffa6a2-770c-1cd9-5145-dcd423f9dd22
  • PlatformId: 3f914b6e-befc-c9a2-7712-d34a12a97fec
  • Service: aspnet-core
  • Sub-service: fundamentals

Related Issues

Activity

  1. guardrex commented on Oct 24, 2026

    @guardrex
    Collaborator

    Thanks, @Albirair! You're absolutely correct, and this is entirely MY fault. 🙈 It happened when I was working on an overhaul of the article, and I didn't write the command correctly. I'll fix the command right now and get it merged as soon as possible. Thanks for letting me know!

  2. self-assigned this
    on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions