简体   繁体   中英

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).
However at the Solution Explorer the newly added file is not nested under Web.config. Any idea?
See image -
I would like Web.Staging.config to be nested just as Web.Release.config:
Solution Explorer
(Assume VS 2012 or 2013).

If all you want is nesting, you could just open your csproj file in a text editor and change this:

<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”

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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