question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Migrations: CLI Tools: Honor ASPNETCORE_ENVIRONMENT

See original GitHub issue

From @opensrcken on November 2, 2016 7:57

Representative of the script I’m using when I encounter said bug.

SET ASPNETCORE_ENVIRONMENT=Test
dotnet ef database update

env.EnvironmentName does not not seem to be aware of ASPNETCORE_ENVIRONMENT when running the second command. Instead, it is always set to Development.

Copied from original issue: dotnet/core#327

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

11reactions
mrtgrcommented, May 31, 2018

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.

7reactions
bricelamcommented, May 29, 2018

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'
Read more comments on GitHub >

github_iconTop Results From Across the Web

ef core doesn't use ASPNETCORE_ENVIRONMENT ...
I use visual studio to update all my environments with a certain migration. It had worked fine using the command below. update-database - ......
Read more >
Migrate from ASP.NET Core 2.0 to 2.1
This article covers the basics of migrating an ASP.NET Core 2.0 app to 2.1.
Read more >
Setting environment variables for ASP.NET Core apps in a ...
In this post I show how you can pass environment variables to your ASP.NET Core apps deployed in Kubernetes using Helm.
Read more >
dotnet/efcore rel/2.0.0-preview1 on GitHub
Migrations : Exception thrown with model containing TPH in certain cases: The entity type should derive from to reflect the hierarchy of the...
Read more >
How to work with EF Core migrations in ASP.NET Core
You can work with migrations either from within Visual Studio via the Package Manager Console or by using a command-line tool to run...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found