Open macsux opened 6 years ago
You can manually set the ASPNETCORE_ENVIRONMENT
environment variable before calling dotnet ef
.
I don't call dotnet ef
directly - it's being called for me by Visual Studio during a publish to azure.
Interesting. We may need to add an option to the publish dialog for this...
@bricelam to provide workaround. @divega to follow up about how this works on deployment.
To work around this, you can set the environment variable before launching Visual Studio when publishing:
SET ASPNETCORE_ENVIRONMENT=Production
devenv
@bricelam, should we treat this as a duplicate of https://github.com/aspnet/EntityFrameworkCore/issues/8695? Otherwise can you remind me what this one is about?
We were going to follow up with the Web Publish team about adding an option in the UI to specify the environment.
@mlorbetske is now tracking this in his list. Clearing up fields to decide what to do with this issue.
To work around this, you can set the environment variable before launching Visual Studio when publishing:
SET ASPNETCORE_ENVIRONMENT=Production devenv
Or on the Properties > Debug debug tab set it
@rick
To work around this, you can set the environment variable before launching Visual Studio when publishing:
SET ASPNETCORE_ENVIRONMENT=Production devenv
Or on the Properties > Debug debug tab set it
And? how do I change between environments? You can't just say "this is solution" but then not show how it works.
If I manually change the variable (ew!) then it stays changed no matter what mode I run visual studio in. Please be specific, and clear, in your answers. Also when writing @microsoft docs. We ain't all geniuses with 30 years experience.
dotnet ef migrations script
always defines Development environmental variable. For applications that use InMemory EF provider when running in Development mode by defining multipleConfigure{EnvironmentName}Services
blocks this creates a problem, especially when trying to publish to Azure.Steps to reproduce
Problem is visible in https://github.com/dotnet-architecture/eShopOnWeb when trying to publish on azure and apply migrations on publish.
Further technical details
EF Core version: 2.0.2 Database Provider: Mixed Operating system: IDE: Visual Studio 2017 15.6.2