dotnet / project-system

The .NET Project System for Visual Studio
MIT License
967 stars 386 forks source link

Support for file nesting for legacy projects #9448

Closed bstordrup closed 5 months ago

bstordrup commented 5 months ago

Summary

I would really like to have File nesting support for MSBuild style projects. Currently, it is only for web projects and Sdk Style projects.

User Impact

Having File nesting support for MSBuild style projects could decrease the initial tree size when browsing the Solution Explorer because partial classes in multiple classes could be nested under the main class file.

drewnoakes commented 5 months ago

Hi @bstordrup,

This repo doesn't track work for the legacy project system, and that team doesn't track work on GitHub. Please file a request on https://learn.microsoft.com/en-us/visualstudio/ide/suggest-a-feature?view=vs-2022.

That said, I doubt this would be added any time soon. As a workaround, you can specify nesting yourself in code.

The nesting feature you refer to is known as "dynamic" file nesting. I.e. the relationship between parent/child files is applied automatically. Behind the scenes, it's just setting DependentUpon metadata. In legacy projects, all compile items are listed explicitly in the project. If you add the parent file name as a DependentUpon value, it'll nest in solution explorer.

drewnoakes commented 5 months ago

Your other option is to upgrade those projects to SDK-style.

bstordrup commented 5 months ago

@drewnoakes, I know another option is to upgrade to Sdk Style projects. That's in the roadmap for the solution, but might be some time into the future though.

Mads Kristensen created an extension for earlier versions of Visual Studio supporting it, and I found out that there is a pull request in his repository to upgrade the extension for Visual Studio 2022.

drewnoakes commented 5 months ago

Indeed upgrading is not something to take lightly and I don't mention it dismissively.

Can you link that PR? I'll ping Mads about it.

bstordrup commented 5 months ago

I already pinged him on it. Actually, there are two pull requests there adding support for VS 2022.

In the mean time, I forked his repository, applied the changes in the pull request and build a vsix package locally, that I installed. Works like a charm ;-)

drewnoakes commented 5 months ago

I don't see any further action here so will close this. Thanks.