Skip to content

Related files support #159

Closed
Closed

Description

@davkean

C# and VB have a registration API for automatically registering dependency relationship between files so that they are automatically parented underneath and hidden in some cases.

For example, in VB, Foo.Designer.cs and Foo.resx is automatically grouped under Foo.cs, and both are hidden by default.

We should implement similar support - but I'd like to see an MSBuild equivalent of this - not via the registry as it is today:

image

See: CVbPackage::InitializeRelatedFiles and CCSharpPackage::InitializeRelatedFiles internally.

We should make sure that we have sensible defaults that do not require DependantUpon metadata item to be written to the project file.

Activity

  1. added this to the milestone on May 17, 2016
  2. added
    Parity-Legacy-Feature
    on May 17, 2016
  3. paul1956 commented on May 17, 2016

    @paul1956

    Today in VB if you add an existing form, the related don't always get copied and if you use the OS to copy all the files you have to restart Visual Studio for the nesting to happen. It would be nice if these were cleaned up as part of the change.

  4. davkean commented on May 17, 2016

    @davkean
    MemberAuthor

    👍

  5. davkean commented on May 25, 2016

    @davkean
    MemberAuthor

    Wonder if a hybrid approach of using project.json's heuristics + flags to hide nested types for the VB cases might be enough.

  6. asbjornu commented on May 25, 2016

    @asbjornu
    Member

    I've experienced cases where related files like these aren't automatically grouped unless you hand edit the .csproj file and add some MSBuild voodoo. What and where, I don't remember. I just mention it as another argument for doing something about this grouping, which I agree is a nice feature. 😃

  7. added
    Parity-XProj
    on May 25, 2016
  8. asbjornu commented on May 26, 2016

    @asbjornu
    Member

    People seem to want this feature turned off too, so a flexible way to configure which files are nested by which pattern and the ability to turn this on and off on a per-file basis (without writing megabytes of XML) would be neat.

  9. added
    Feature-Project-File-Simplification
    on Jun 15, 2016
  10. modified the milestones: , on Jun 24, 2016
  11. 63 remaining items

  12. Pilchie commented on Sep 14, 2018

    @Pilchie
    Member

    @lifengl added support for this in CPS, but we need to opt in to a capability I think. @lifengl - can you let us know what the capability is? @drewnoakes do you want to tackle adding that?

  13. drewnoakes commented on Sep 14, 2018

    @drewnoakes
    Member

    @Pilchie for sure. I'll take a look on Monday. @lifengl anything you can tell me about CPS support for this would be appreciated.

  14. lifengl commented on Sep 17, 2018

    @lifengl
    Contributor

    Your project need turn on the capability "DynamicDependentFile", which enables the feature to compute file dependencies dynamically. It was turn on in web .Net Core projects, but not in a plain .Net Core projects. Note: web project has its own dynamic dependencies rule applied, The code to read registry for file dependencies is only added in the next version of CPS. (BTW, I think maybe ML team is the right team to own this logic, since it is only turned on for .Net Core projects. Let me know if you agree, and want to move that piece of code to the ML project system codebase.)

  15. lifengl commented on Sep 17, 2018

    @lifengl
    Contributor

    BTW, the logic to use project registry for file dependencies is turned on for .Net Core project, with or without the capability. Without the capability, the dependency is only computed for new files, and persisted into the project file like the old project system. With the capability, it will not persisted, but dynamically computed.

  16. modified the milestones: 16.0, 16.1 on Dec 18, 2018
  17. drewnoakes commented on Jan 4, 2019

    @drewnoakes
    Member

    This was fixed in #4376.

  18. dferretti commented on Aug 25, 2021

    @dferretti

    @davkean from this old comment #159 (comment)
    Is this still the case? It appears so to me - I'm using VS2019 and VS2022 preview 3 on a Microsoft.NET.Sdk.Worker console app and not getting appsettings.json nesting. This issue is closed but is there one open specific for non-ASPNET projects?

  19. Allann commented on Aug 26, 2021

    @Allann

    File nesting is definitely not working for me either in 2019 or 2022 p3. I have both .core 3.1, .net5 and 6 projects and non of then apply nesting outside of the web project.

  20. drewnoakes commented on Aug 31, 2021

    @drewnoakes
    Member

    @Allann for now this is behind a feature flag for non-web projects:

    image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Feature-Project-File-SimplificationFeature-WinFormsParity-Legacy-FeatureParity-XProj

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions