I have two asp.net core console apps.
First one has appsettings json files as shown below.

As you can see they are nicely nested.
The second core project is also console project. I have added appsettings json files but they are nested.
What am I missing

I had the same issue in my console application.
I noticed the following string in my project file
<Project Sdk="Microsoft.NET.Sdk">
I changed it to
<Project Sdk="Microsoft.NET.Sdk.Worker">
After I saved the project, the settings files became nested.
You can edit the project file to add this element:
<ItemGroup>
<None Update="appsettings.Development.json">
<DependentUpon>appsettings.json</DependentUpon>
</None>
</ItemGroup>
<ItemGroup>
<None Update="appsettings.Release.json">
<DependentUpon>appsettings.json</DependentUpon>
</None>
</ItemGroup>
result:

Don't forget to reload your project if you edit it outside of Visual Studio.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With