Makla
Makla

Reputation: 10469

How to nest files by path segment in VS 2017 for ASP.NET Core project

I am trying to nest files by pathSegment in Visual Studio 2017 for ASP.NET Core project.

I added .filenesting.json file to solution folder with content:

{
    "help": "https://go.microsoft.com/fwlink/?linkid=866610",
    "root": true,   //Also tried with false

    "dependentFileProviders": {
        "add": {
            "pathSegment": {}
        }
    }
}

but it's not working even when restarting VS. I think it should work, based on this documentation.

Not sure if file nesting should be enabled or disabled.
Problem is I can not see solution settings in dropdown:

screenshot

but it is under edit:

screenshot 2

I also tried with custom setting (not solution) and it also doesn't work. What did I miss?

Upvotes: 5

Views: 573

Answers (1)

Nick Craver
Nick Craver

Reputation: 630627

I think the documentation is wrong here - that screenshot is missing the actual rules. I dug into it for Stack Overflow and hit the same thing...here's what actually works for your case in .filenesting.json:

{
  "help": "https://go.microsoft.com/fwlink/?linkid=866610",
  "root": true,
  "dependentFileProviders": {
    "add": {
      "pathSegment": {
        "add": {
          "Help.*": [ ".cs" ]
        }
      }
    }
  }
}

The only important diff (AFAIK) is the actual rule "add" itself.

Upvotes: 8

Related Questions