visual-studio - 在 Visual Studio 中对文件进行分组

标签 visual-studio

我正在考虑在 Visual Studio 中整理我的项目布局,我想知道是否有任何 hack、插件或技巧可以将 .xml 文件与同名的 .cs 文件关联起来 因此它们出现在我的解决方案导航器/资源管理器中。

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

alt text

欢迎任何建议。谢谢

最佳答案

在您的项目文件中:

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

或者您可以使用VSCommands 2010Group Items命令扩展名。

编辑:以防万一您的文件位于文件夹中,请勿在 DependentUpon 标记中包含文件夹名称。例如,如果您的文件位于 Helpers 文件夹中:

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

关于visual-studio - 在 Visual Studio 中对文件进行分组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3617539/

相关文章:

c# - Visual Studio C# 共享项目中的静态文件(JS、CSS 等)

windows - 库导入 : #pragma comment VS Visual studio project input

c++ - 错误 C1903 - 调用 offsetof 时无法从以前的错误中恢复

c++ - 包括 boost/asio.hpp 抛出错误

visual-studio - 我的 CSS 图像无法在 Windows Azure 上运行

c++ - 将 strcpy_s() 和 strcat_s() 与动态分配的字符串一起使用

c - 是否可以使用 Visual C++ 编译前 ANSI(K&R 风格)C 代码?

javascript - http get 在 Cordova 不起作用

c# - 创建新字段的快捷方式

windows - 如何修复 Windows 8.1 中的 visual studio 错误 "cannot find one or more components .Please re-install the application"?