如何在解决方案资源管理器 VS2010 中对部分类文件进行分组 [英] How to group partial class files in Solution Explorer VS2010

查看:54
本文介绍了如何在解决方案资源管理器 VS2010 中对部分类文件进行分组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能的重复:
Visual Studio 中的文件分组

问题是,我想在解决方案资源管理器中以某种方式对部分类文件进行分组,Visual Studio 在文件名前面显示一个 [+],我可以将其展开以查看所有其他相关文件.

The problem is, that I want to group partial class files in a way in the Solution Explorer, that visual Studio displays a [+] in front of the filename which I than can expand to see all other dependant files.

但我的课程显示在彼此下方的两行中:

But my classes are shown in two rows below each other:

> CustomerServiceDao.cs
> CustomerServiceDao.Query.cs

我想要的结果就是这样.

The result I want to have is something like that.

+ CustomerServiceDao.cs
    > CustomerServiceDao.Query.cs

为了显示分组的部分文件,我必须遵循任何命名约定吗?

Is there any naming convention which I have to follow in order to show the partial files grouped?

它有效.那太棒了.但是有任何命名约定吗?例如ascx 默认情况下这样做...

It works. That's great. But are there any naming conventions? e.g. ascx does it by default ...

推荐答案

如果您将 .csproj 作为文本文件打开(或从解决方案资源管理器的上下文菜单中为项目,然后是编辑 myproject.csproj"),您可以将其更改为以您希望的样式在解决方案资源管理器中显示相关文件.

If you open your .csproj as a text file (or choose "Unload Project" from the context menu in Solution Explorer for the project, followed by "Edit myproject.csproj") you can change it to show the relevant files in Solution Explorer in the style you wish.

寻找:

<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 提供的可扩展性模型,可能用不了多久就会有人制作出一些东西.

There's no way to do this directly within the Visual Studio editor, but given the extensibility model that VS2k10 provides, it probably won't be long before someone produces something.

更新:最新版本的VSCommands 声称支持为您执行此操作:

Update: The latest version of VSCommands claims to support doing this for you:

最新版本支持对来自 IDE 的项目进行分组(因此您不必使用 DependentUpon 手动修改项目文件).

这篇关于如何在解决方案资源管理器 VS2010 中对部分类文件进行分组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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