In Asp.Net I create ViewModels that are the models for a particular view; one viewmodel per view. Because it’s a one-to-one relationship, I like keeping the ViewModel as a nested file to the view. It’s very tidy this way.
In Asp.Net MVC files will appear nested most of the time. However, sometimes they become unnested. I can remedy this by cutting-and-pasting-and-renaming the files, which renests them. However, it sure would be nice to have the ‘nest related files’ appear in the solution explorer in Visual Studio for an MVC project.
Any ideas why that icon (“nest related files”) is missing from Visual Studio? and how might I get it back?
Thanks!
You can do this with the VSCommands Extension. Take a look in the studio gallery.
The alternative is either as you have been doing – copying and pasting files, or by editing the project file directly.
Found it – check on the VSCommands feature page – it’s listed as Group/Ungroup Items
http://vscommands.com/features/
To group items, in solution explorer highlight both items you want to group (parent & child), r-click the child and choose “Group Items”.
To ungroup items, in solution explorer highlight the child you want to ungroup, r-click and choose “Ungroup Items”.