Aditya Dara
Aditya Dara

Reputation: 13

AddUserSecrets not working when running migrations

Setup for development on local machine:

Problem:

Couple of interesting observations:

Note

How can I get user secrets to be loaded properly when ASPNETCORE_ENVIRONMENT is NOT development when running EF Core migrations?

Upvotes: 0

Views: 40

Answers (1)

sa-es-ir
sa-es-ir

Reputation: 5102

As @browsermator mentioned in the comments, from EF Core 5, it will set the ASPNETCORE_ENVIRONMENT and DOTNET_ENVIRONMENT environment variables to "Development".

But it is possible to set a custom environment when using cli command:

dotnet ef database update -- --environment Local

For more details please check the document.

Upvotes: 0

Related Questions