Display AppSetting.json as a "versioned or nested" File In Visual Studio UI [duplicate]


I have a .NETStandard library & need to add (versioned) JSON files by configuration-environment. The trick is…I want to see if it is possible to setup the Project File (.proj) to list them in the same manner they would if it was a Web.Config file.

FOR EXAMPLE:
A web.config will display this way in Visual Studio
Web Config by-environment

It accomplishes this by doing the following in the .PROJ file:

<None Include="Web.Debug.config">
  <DependentUpon>Web.config</DependentUpon>
</None>
<None Include="Web.ModelOffice.config">
  <DependentUpon>Web.config</DependentUpon>
</None>
<None Include="Web.Release.config">
  <DependentUpon>Web.config</DependentUpon>
</None>
<None Include="Web.Development.config">
  <DependentUpon>Web.config</DependentUpon>
</None>
<None Include="Web.Production.config">
  <DependentUpon>Web.config</DependentUpon>
</None>

So, to be clear…

Desired Effect

But this does NOT work in a .NETStandard library…

<None Include="appsettings.json" />
<None Include="appsettings.development.json">
  <DependentUpon>appsettings.json</DependentUpon>
</None>
<None Include="appsettings.modeloffice.json">
  <DependentUpon>appsettings.json</DependentUpon>
</None>
<None Include="appsettings.production.json">
  <DependentUpon>appsettings.json</DependentUpon>
</None>

Leave a Reply

Your email address will not be published. Required fields are marked *