I'm looking at tidying up my project layout in Visual Studio and I'm wondering if there is any hack, plugin or trick to associate an .xml file with a .cs file of the same name so they appear grouped in my solution navigator/explorer.
Similar to the way the code-behind file is associated with its aspx.
Any suggestions welcome. Thanks
The precedence for merging file nesting settings is: Visual Studio > Solution > Project. You can tell Visual Studio to ignore solution-specific and project-specific settings, even if the files exist on disk, by enabling the option Ignore solution and project settings under Tools > Options > ASP.NET Core > File Nesting.
Visual Studio allows you to specify how more than one project is run when you press F5 (Start with Debugging), or Ctrl+F5 (Start without debugging), or use the toolbar button to launch your application.
Solution Explorer is a special window that enables you to manage solutions, projects, and files. It provides a complete view of the files in a project, and it enables you to add or remove files and to organize files into subfolders.
In your project file :
<Compile Include="FileA.cs"/> <Compile Include="FileA.xml"> <DependentUpon>FileA.cs</DependentUpon> </Compile>
Or you could use Group Items
command of VSCommands 2010 extension.
Edit: Just in case your file is in a folder, don't include the folder name in DependentUpon
tag. For example if your file is in Helpers
folder:
<Compile Include="Helpers\FileA.cs"/> <Compile Include="Helpers\FileA.xml"> <DependentUpon>FileA.cs</DependentUpon> </Compile>
If you do not want to slow down you IDE with heavy and proprietary VSCommands extension you can use small extension NestIn instead. It can nothing but group/ungroup files
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With