Possible Duplicate:
Group files in Visual Studio
问题是,我想在解决方案资源管理器中以某种方式对部分类文件进行分组,Visual Studio 在文件名前面显示一个 [+],我可以展开该文件以查看所有其他依赖文件。
但是我的类(class)显示在彼此下方的两行中:
> CustomerServiceDao.cs
> CustomerServiceDao.Query.cs
我想要的结果就是这样。
+ CustomerServiceDao.cs
> CustomerServiceDao.Query.cs
为了显示分组的部分文件,我是否必须遵循任何命名约定?
编辑
它有效。那太棒了。但是有命名约定吗?例如ascx 默认情况下这样做...
最佳答案
如果您将 .csproj
作为文本文件打开(或从项目的解决方案资源管理器的上下文菜单中选择“卸载项目”,然后选择“编辑 myproject.csproj”),您可以更改它以您希望的样式在解决方案资源管理器中显示相关文件。
寻找:
<Compile Include="CustomerServiceDao.cs" />
<Compile Include="CustomerServiceDao.Query.cs" />
并将其编辑为:
<Compile Include="CustomerServiceDao.cs" />
<Compile Include="CustomerServiceDao.Query.cs">
<DependentUpon>CustomerServiceDao.cs</DependentUpon>
</Compile>
无法直接在 Visual Studio 编辑器中执行此操作,但考虑到 VS2k10 提供的可扩展性模型,可能用不了多久就会有人产生一些东西。
更新: 最新版本 VSCommands声称支持为您执行此操作:
Latest version supports grouping items from IDE (so you don't have to hand-hack project file with DependentUpon).
关于visual-studio-2010 - 如何在解决方案资源管理器 VS2010 中对部分类文件进行分组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3621345/