change environment during database update

.net entity-framework entity-framework-core

Question

i am trying to update my database but dotnet ef database update uses wrong ASPNETCORE_ENVIRONMENT In log I see this Using environment 'Development' instead ofLocal`

this is my command :

dotnet ef database update --startup-project ../API --configuration Local --verbose

"Local": {
      "commandName": "IISExpress",
      "launchBrowser": true,
      "environmentVariables": {
        "ASPNETCORE_ENVIRONMENT": "Local"
      }
    },

I also tried to use --environment Local but environment isn't defined as option even if https://github.com/aspnet/EntityFrameworkCore/issues/7353 states otherwise

1
2
5/24/2018 10:38:37 AM

Accepted Answer

it seems you need to add run this command before database update

$Env:ASPNETCORE_ENVIRONMENT = "Local"
1
5/24/2018 10:52:00 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow