-
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
Migrations: CLI Tools: Honor ASPNETCORE_ENVIRONMENT #7353
Comments
From @Petermarcu on January 5, 2017 0:51 @Eilon , Where's the best place to track this? |
Bug might not be in EF, but at least we should start the investigation here. |
did you try using "Setx" instead of "Set"? |
We don't currently honor the
|
@bricelam should we add support for that env var? It's a bit gross to tie the two together, but it's also a very common scenario to use EF in ASP.NET. |
We should definitely consider it. |
I love definite maybes! 😄 |
Any plans to address this and start taking into account ASPNETCORE_ENVIRONMENT by any chance? The EF Core docs recommend setting this env variable which is a bit confusing since it's not being used (see tip green box |
It has worked since version 2.0.0-preview1. Note, if you're using PowerShell, the syntax to set an environment variable is different than command prompt: $env:ASPNETCORE_ENVIRONMENT = 'Production' |
That's great news thanks for the update @bricelam! |
I'm writing $env:ASPNETCORE_ENVIRONMENT = 'Production' in Package Manager Console and then running Update-Database but still gives the same warning "No Migrations were applied". It is still not respecting to my ASPNETCORE_ENVIRONMENT. |
@mrtgr Can you please file a new issue and include a runnable project/solution that demonstrates the behavior you are seeing? |
I have recently had a problem with EF tool not using connection strings from my "appsettings.Production" file, it Turns out that if EF Tool has trouble with the "appsettings.Production"(E.g null string) , it will revert to using appsettings. I have not been able to see this written to the console by the EF tool, but using the "-verbose" flag with database update, the environment will be written to the console. Just wanted to mention this as I have not seen this documented anywhere. |
From @opensrcken on November 2, 2016 7:57
Representative of the script I'm using when I encounter said bug.
env.EnvironmentName
does not not seem to be aware ofASPNETCORE_ENVIRONMENT
when running the second command. Instead, it is always set toDevelopment
.Copied from original issue: dotnet/core#327
The text was updated successfully, but these errors were encountered: