有没有办法进行自定义“分组”? Visual Studio 的解决方案资源管理器中的文件数量?

发布于 2024-07-29 08:36:35 字数 225 浏览 4 评论 0原文

为了多解释一下,我有一个文件 Sidebar.cs、Sidebar.js 和 Sidebar.css。

我希望能够将其设为 Sidebar.cs、Sidebar.cs.js 和 Sidebar.cs.css,并让 js 和 css 文件位于树视图中 Sidebar.cs 节点的“下方”(作为其子节点) ,就像 .designer 文件和 .aspx.cs 文件发生的情况一样。

这有可能实现吗?

To explain a little more, I have a file Sidebar.cs, and I have Sidebar.js, and Sidebar.css.

I would like to be able to make it Sidebar.cs, Sidebar.cs.js, and Sidebar.cs.css, and have the js and css file go "under" (as children of) the Sidebar.cs node in the treeview, just like what happens with .designer files and .aspx.cs files.

Is this possible to accomplish?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

抚你发端 2024-08-05 08:36:35

在文本编辑器中打开项目文件或使用“编辑项目文件”上下文菜单(可能只是我拥有的加载项的一部分)。 然后,您可以使用 DependentUpon XML 标记来获取层次结构。 例如,这是表单及其设计器的外观:

<Compile Include="Views\SSWizardForm.cs">
  <SubType>Form</SubType>
</Compile>
<Compile Include="Views\SSWizardForm.designer.cs">
  <DependentUpon>SSWizardForm.cs</DependentUpon>
</Compile>

请注意“DependentUpon”标签,意思是“使其成为另一个文件的子文件”。

Open up the project file in a text editor or using the "edit project file" context menu (might be only part of an add-in I have). You can then use the DependentUpon XML tag to get the hierarchy. For example, this is how a Form and it's designer look:

<Compile Include="Views\SSWizardForm.cs">
  <SubType>Form</SubType>
</Compile>
<Compile Include="Views\SSWizardForm.designer.cs">
  <DependentUpon>SSWizardForm.cs</DependentUpon>
</Compile>

Note the "DependentUpon" tag, meaning "make this a child of another file".

眼泪淡了忧伤 2024-08-05 08:36:35

我自己还没有尝试过这个,所以对此持保留态度,但这是我通过查看我必须手动打开的项目来推断的

在记事本(或其他首选文本编辑器)中打开项目文件,以及项目文件,因此它看起来像

<Compile Include="whatever.cs">
  <DependentUpon>whatever.else</DependentUpon>
</Compile>
<None Include="whatever.else" />

而不是

<Compile Include="whatever.cs" />

根据需要包含尽可能多的 DependentUpon 子句和 None 元素

I haven't tried this myself, so take this with a pinch of salt, but this is what I infer by looking at projects I have to hand

Open the project file in notepad (or other preferred text editor), and the structure of a project file so it looks like

<Compile Include="whatever.cs">
  <DependentUpon>whatever.else</DependentUpon>
</Compile>
<None Include="whatever.else" />

instead of

<Compile Include="whatever.cs" />

with as many DependentUpon clauses and None elements as needed

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文