You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Migration scripts are always generated for "Development" environment #11950
dotnet ef migrations script always defines Development environmental variable. For applications that use InMemory EF provider when running in Development mode by defining multiple Configure{EnvironmentName}Services blocks this creates a problem, especially when trying to publish to Azure.
Exception message:
Microsoft.EntityFrameworkCore.InMemory is not a Relational provider and therefore cannot be use with Migrations.
To work around this, you can set the environment variable before launching Visual Studio when publishing:
SETASPNETCORE_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.
Activity
bricelam commentedon May 9, 2018
You can manually set the
ASPNETCORE_ENVIRONMENTenvironment variable before callingdotnet ef.macsux commentedon May 9, 2018
I don't call
dotnet efdirectly - it's being called for me by Visual Studio during a publish to azure.bricelam commentedon May 9, 2018
Interesting. We may need to add an option to the publish dialog for this...
divega commentedon May 10, 2018
@bricelam to provide workaround. @divega to follow up about how this works on deployment.
bricelam commentedon May 11, 2018
To work around this, you can set the environment variable before launching Visual Studio when publishing:
divega commentedon Jul 25, 2018
@bricelam, should we treat this as a duplicate of #8695? Otherwise can you remind me what this one is about?
bricelam commentedon Jul 26, 2018
We were going to follow up with the Web Publish team about adding an option in the UI to specify the environment.
10 remaining items
GeorgeAlexandruD commentedon Sep 20, 2023
@rick
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.
rick commentedon Oct 13, 2023
lkurzyniec commentedon Jan 2, 2025
https://learn.microsoft.com/en-us/ef/core/cli/dotnet#aspnet-core-environment
AndriySvyryd commentedon Aug 13, 2026
This isn't something that can be fixed on the EF Core side, we recommend using CLI