dotnet / dotnet/EntityFramework.Docs

Environment is not settable via argument

Open
#4,802 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Mermaid
Stars
1.7k
Forks
2k
Avg merge
7d 23h
Merged PRs (30d)
16

Description

### Type of issue

Code doesn't work

### Description

ASP.NET Core environment
You can specify [the environment](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/environments) for ASP.NET Core projects on the command-line. This and any additional arguments are passed into Program.CreateHostBuilder.

PowerShell

Copy
Update-Database -Args '--environment Production'

[Enter feedback here]

This doesn't work. When running this command in the VS PMC environment has no effect on the host.
https://github.com/dotnet/efcore/issues/9623
https://github.com/dotnet/efcore/issues/9664
https://github.com/dotnet/efcore/issues/8328

Please update documentation on how to correctly set the environment.
My code uses the IDesignTimeDbContextFactory

### Page URL

https://learn.microsoft.com/en-us/ef/core/cli/dbcontext-creation?tabs=dotnet-core-cli

### Content source URL

https://github.com/dotnet/EntityFramework.Docs/blob/main/entity-framework/core/cli/dbcontext-creation.md

### Document Version Independent Id

d988e806-cb86-19f5-7f76-6ce3bfcd94ed

### Article author

@bricelam

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.