Tools: Default DOTNET_ENVIRONMENT to Development too #19903
Labels
area-scaffolding
closed-fixed
The issue has been fixed and is/will be included in the release indicated by the issue milestone.
customer-reported
poachable
type-enhancement
Milestone
When running Scaffold-DbContext, Named connection strings are not loaded from user secrets if a generic host project does not call
.ConfigureWebHostDefaults()
.I believe this is happening because only the
ASPNETCORE_ENVIRONMENT
variable is set and not theDOTNET_ENVIRONMENT
variable in AppServiceProviderFactory.cs.I feel like the expected behaviour is for named connection strings to be usable via User Secrets for both Asp and Worker Service projects. The other non environment conditional configuration sources can currently be used for Worker Services.
Steps to reproduce
In Visual Studio, Create a Worker Service with the Worker Service template.

Install ef core, a database provider and the ef core tools and also User Secrets.
Further technical details
EF Core version: 3.1.1
Database provider: Not provider specific but I used Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET Core 3.1
Operating system: Windows 10
IDE: Visual Studio 2019 16.4.4
The text was updated successfully, but these errors were encountered: