简体   繁体   English

如何添加嵌套的Web.config文件?

[英]How to add a nested Web.config file?

I tried adding a new web.config file to my asp.net app (I went through right click on the project -> add -> Web Configuration File). 我尝试将新的web.config文件添加到我的asp.net应用程序中(我右键单击了项目 - >添加 - > Web配置文件)。
However at the Solution Explorer the newly added file is not nested under Web.config. 但是,在解决方案资源管理器中,新添加的文件未嵌套在Web.config下。 Any idea? 任何的想法?
See image - 看图像 -
I would like Web.Staging.config to be nested just as Web.Release.config: 我希望Web.Staging.config像Web.Release.config一样嵌套:
Solution Explorer
(Assume VS 2012 or 2013). (假设VS 2012或2013)。

If all you want is nesting, you could just open your csproj file in a text editor and change this: 如果你想要的只是嵌套,你可以在文本编辑器中打开你的csproj文件并更改它:

<None Include="Web.Staging.config" />

to this: 对此:

<None Include="Web.Staging.config">
  <DependentUpon>Web.config</DependentUpon>
</None>

Take a look at this blog . 看看这个博客

Specifically: 特别:

To add configuration specific transform file (eg Web.Staging.Config) you can right click the original web.config file and click the context menu command “Add Config Transforms” 要添加特定于配置的转换文件(例如Web.Staging.Config),您可以右键单击原始web.config文件,然后单击上下文菜单命令“Add Config Transforms”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM