Erez Cohen
Erez Cohen

Reputation: 1517

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).

Upvotes: 15

Views: 10997

Answers (3)

Edu_LG
Edu_LG

Reputation: 1730

You can also currently use the File Nesting tool

https://marketplace.visualstudio.com/items?itemName=MadsKristensen.FileNesting

Upvotes: 0

Marcus
Marcus

Reputation: 338

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>

Upvotes: 25

to StackOverflow
to StackOverflow

Reputation: 124696

Take a look at this blog.

Specifically:

To add configuration specific transform file (e.g. Web.Staging.Config) you can right click the original web.config file and click the context menu command “Add Config Transforms”

Upvotes: 7

Related Questions