This snippet allows Visual Studio to automatically nest .cs files with a filename "suffix" under parent .cs files.
For example, "MyFile.Partial.cs" would be nested under "MyFile.cs".
<Project Sdk="Microsoft.NET.Sdk"> | |
<ItemGroup> | |
<NestedItem Include="@(Compile)"> | |
<Parent>%(Identity)</Parent> | |
<Children>%(RelativeDir)%(Filename).*.cs</Children> | |
</NestedItem> | |
</ItemGroup> | |
<ItemGroup> | |
<Compile Update="@(NestedItem->'%(Children)')"> | |
<DependentUpon>%(NestedItem.Parent)</DependentUpon> | |
</Compile> | |
</ItemGroup> | |
</Project> |