-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EF Core 2.0 Update-Database Powershell command doesn't recognize Environment parameter #9664
Comments
Looks like you need to explicitly set the environment in powershell before running the update-database command. In my case, this worked for me:
I don't know why this was changed-- preferred the older way with the -Environment argument so that it's only one command needed to run. Can the -Environment argument be added back to update / drop database commands? |
See #8328 for context |
I tried, but still not work :( |
I am encountering this as well. We purposefully have the root appsettings.json have a token for the connectionstring so that it can be replaced by the deployment script and have the appsettings.Development.json override the setting for the developer workstations. The Update-Database command seems to totally ignore environment and only use the root appsettings.json. |
Bring back the -e switch. Removing functionality that we relied on makes no sense. |
Issue still occurs. appsettings.Development.json ignored. |
Just wrestled with this on a Windows server running TeamCity hosting multiple builds across multiple environments (development, staging, etc). The following build step didn't work: set ASPNETCORE_ENVIRONMENT=staging && dotnet ef database update ... In order to properly set the environment, it was necessary to put each command on a new line: set ASPNETCORE_ENVIRONMENT=staging |
I've also just run into this issue, it took using -verbose to track down what was going on, good job there weren't any migrations to be run on one of our environments! Our issue is that we're using Development for something other than local dev. The startup project is configured correctly, and has the correct environment set in the debug properties, but EF core via powershell isn't honouring this, and is instead just assuming development. Can we get it honouring this if it's set against the startup project? It's a bit of a pain having to set the environment variable in the powershell host. |
Got my ASP.NET Core 2.0 + EF Core 2.0 project up and running locally. Now when I'm trying to set up my production database using the powershell update-database command like this:
targeting my production environment, the command fails and says it doesn't recognize the 'Environment' parameter:
Seems like this parameter is missing entirely. Is there a different way to run the update-database command to target a particular environment based on appsettings.{environment}.json?
The text was updated successfully, but these errors were encountered: