0

After some years of lurking around, I finally have an issue that I can't find an existing answer to:

I need to run Update-Database against my staging system (Azure SQL) but the generated script seems to be determined for my development environment (Postgres).

Did anybody else encounter this issue, or is this just a wrong setup on my part?

For context: I used the environment-specific ConfigureService methods (like ConfigureDevelopmentServices()) and trace their call.

I'm using the using NugetPackageManagement Console under VS2019 Mac and changed the environment for my session to staging via Env: ASPNETCORE_ENVIRONMENT = "Staging". The database connection is established accordingly, but the script shows me that it's generation runs in "Development".

As a quick fix, I will change my development-settings to use the staging system - but I hope that there is a better solution at hand.

Best regards Lutz

Mahyar Mottaghi Zadeh
  • 1,178
  • 6
  • 18
  • 31
Ulfbe
  • 1
  • This appears to be a duplicate of: https://stackoverflow.com/questions/48432028/how-do-i-change-connection-string-for-update-database-ef-migrations - does that answer you question? – Lacutah Feb 03 '21 at 16:38
  • Hey @Lacutah, thanks for your research and reply - to answer your question: Unfortunately not really. My issue is slightly different, since i already made use of the manuel setting of the ASPNETCORE_ENVIRONMENT and the correct database was connected. However the sql script was generated for the wrong database. – Ulfbe Feb 04 '21 at 17:22
  • Did you set the ASPNETCORE_ENVIRONMENT in the package manager console? It sounds like that's where it needs to be set - it has its own environment settings (even though it may appear to be inside Visual Studio...) – Lacutah Feb 04 '21 at 19:54

0 Answers0