3

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

user1075940
  • 1,086
  • 2
  • 22
  • 46

1 Answers1

4

It seems that you need to run this command before the database update:

$Env:ASPNETCORE_ENVIRONMENT = "Local"
Chris Owens
  • 5,076
  • 12
  • 61
  • 131
user1075940
  • 1,086
  • 2
  • 22
  • 46