在Visual Studio中对文件进行分组 [英] Group files in Visual Studio

查看:263
本文介绍了在Visual Studio中对文件进行分组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在考虑整理Visual Studio中的项目布局,并且想知道是否存在将.xml文件与同名.cs文件关联的任何黑客,插件或技巧 ,因此它们在我的解决方案导航器/浏览器中分组显示.

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.

类似于代码隐藏文件与其aspx关联的方式.

Similar to the way the code-behind file is associated with its aspx.

欢迎提出任何建议.谢谢

Any suggestions welcome. Thanks

推荐答案

在您的项目文件中:

<Compile Include="FileA.cs"/>
<Compile Include="FileA.xml">
  <DependentUpon>FileA.cs</DependentUpon>
</Compile>

或者您可以使用 VSCommands 2010 扩展.

以防万一您的文件位于文件夹中,请不要在DependentUpon标记中包含文件夹名称.例如,如果您的文件位于Helpers文件夹中:

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>

这篇关于在Visual Studio中对文件进行分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆