Solutions Explorer 中的 C# 多个自定义 app.config 文件

C# multiple custom app.config files in Solutions Explorer

我有几个自定义 app.config 文件,它们直接指向我的活动解决方案配置。它们似乎工作正常,但我添加的最后两个 App.Davivienda.config 和 App.Futura.config 没有出现在 App.config 树下。它们工作正常,但为什么不显示在那里?

它们没有分层显示的原因是您的 IDE(大概 Visual Studio)不知道这些文件是相关的。解决这个问题很简单。

打开 .csproj 文件并查看您的新文件创建的条目。

它们应该是用 <DependentUpon>App.config</DependentUpon> 标签创建的。

如果不是,请更改您的 .csproj,然后重新打开它。

它们应该是这样的:

<Content Include="App.Futura.config">
    <DependentUpon>App.config</DependentUpon>
</Content>