dotnet / dotnet/project-system

Cannot customize file nesting between xsd and cs files

Open
#8,791 3 comments 0 reactions 1 assignee Claimed by @smitpatel View on GitHub
Feature-File-Nesting needs-more-info Triage-Investigate
Dominant language
C#
Stars
1k
Forks
415
PR merge metrics
No merged PRs in 30d

Description

## Visual Studio Version
17.3.4

## Summary

I'm trying to nest `.xsd` files under `.cs` files.

The rules in `.filenesting.json` seem to have no effect on nesting between `.xsd` and `.cs` file. I've tried adding `root` node and set it to **true**, also adding `remove` node under `dependentFileProviders`, filling it with all the providers.

None of that worked worked and the `.cs` files are always displayed under `.xsd` files. This is also true when file nesting is disabled (with or without custom rules), so I'm thinking the `.xsd` rule is probably hard-coded. Also, creating a custom settings based on defaults, I can see no `.xsd` rule, further indicating that it is hard-coded somehow.

When file nesting is enabled and `.filenesting.json` is present, I also get a compilation warning "Some files inside the project '' are nested under each other, and form a loop. Review the file nesting rules."

## Steps to Reproduce

1. Create a `.cs` and `.xsd` files with same name in .NET 6 project
2. Create a `.filenesting.json` in solution or project folder (changing/removing `root` and/or removing `dependentFileProviders.remove` parts will have no effect)
`
{
"root": true,
"dependentFileProviders": {
"remove": {
"extensionToExtension": {}, "fileSuffixToExtension": {}, "addedExtension": {}, "pathSegment": {}, "allExtensions": {}, "fileToFile": {}
},
"add": {
"extensionToExtension": { "add": { ".xsd": [ ".cs" ] } } }
}
}
`
4. Open the project, enable file nesting and compile. You should see a yellow warning icon on `.xsd` files in solution explorer and a warning

## Expected Behavior
Nest `.xsd` files under `.cs` files.

## User Impact

Slight annoyance because I see new features that seem they can be useful, only to have my hope soiled and my dreams shattered by a bug or an oversight :-D

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.