Reputation: 19012
(Edit for search-ability: called "File Nesting")
I'm not sure if "folding" is the correct term, but the feature I'm referring to is shown in the 1st image below, versus the 2nd one which does not have an expandable tree list node for the code behind file.
My questions are:
References:
Edit
Thanks Sean, but as you can see below, my Nest Related Files
button does show up in this project for some reason:
Should have button shown below:
Edit:
I figured out the reason: I accidentally created a C# Web Application Project, and then added VB ASP.NET files to it.
Upvotes: 2
Views: 838
Reputation: 291
When you are not using a website project, the nesting button in the solution explorer won't appear—but you can still nest files in .NET 5.0 projects.
Here's how you do it:
.csproj
file. Visual studio can open it in its own viewer, or else you can use your favorite XML or text editor.Item Group
element. If there's already one that includes some of your files, put it in there for cleanliness and consistency. If there isn't, create a new one.Content
element for the file you wish to nest. This element's Include
attribute should be the name of your desired file.DependentUpon
child element to your content element. This element's text value should be the name of the file you wish to nest your target file underneath.There's shockingly few questions and answers that address this situation. The above answer didn't help me, so I figured that I would share what did for posterity.
Upvotes: 1
Reputation: 11925
see this related question for a possible registry hack (changing 9.0 to 8.0 in the question's reg script): Visual Studio 2010 related file nesting
Upvotes: 4