Visual Studio 2012 - 在解决方案资源管理器中隐藏文件夹? [英] Visual Studio 2012 - Hide folders from solution explorer?

查看:32
本文介绍了Visual Studio 2012 - 在解决方案资源管理器中隐藏文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在 Visual Studio 2012 解决方案资源管理器窗口中隐藏文件夹?我有多个我不打算使用的文件夹/文件,它们只是让界面混乱,而且更难找到东西.

Is it possible to hide folder in Visual Studio 2012 solution explorer window? I have multiple folders/files that I don't plan to use and they are just cluttering the interface and it's harder to find things.

您可以切换显示隐藏文件"但实际上无法隐藏任何文件似乎很不合逻辑.

It just seems pretty illogical that you can toggle "Show Hidden Files" but you cannot actually hide any files.

WebApi 项目包括我想要使用的自动帮助生成,但是它包括它需要运行的多个文件夹.我只关心控制器/模型,因为我正在构建 Api 本身.但是,如果我从项目中删除/删除这些文件,则帮助生成器将无法工作.

WebApi project includes automated help generation that I want to use, however it includes multiple folders that it needs to function. All I care about is Controllers/Models since I'm building the Api itself. But if I delete/remove from project those files than help generator won't work.

推荐答案

由于您希望文件仍可访问,而不是仅仅排除它们,因此您可以修改 csproj 文件本身.从解决方案中卸载您的项目,右键单击并选择编辑.向下滚动到显示文件夹的位置(我使用名为TestFolder"的文件夹和其中名为 TestClass.cs 的文件进行了测试.

Since you want the files to still be accessible, as opposed to just excluding them, you can modify the csproj file itself. Unload your project from the solution, right-click and select edit. Scroll down to where your folders are displayed (I tested with a folder called "TestFolder" and a file within it called TestClass.cs.

<Compile Include="TestFolder\TestClass.cs">        
    <SubType>Code</SubType>
</Compile>

创建一个名为 Visible 的新子标记并将值设置为 false.

Create a new child tag called Visible and set the value to false.

<Compile Include="TestFolder\TestClass.cs">    
    <Visible>false</Visible>    
    <SubType>Code</SubType>
</Compile>

保存并重新加载项目,文件将不再可见但可访问.我刚刚做了一个快速测试,它似乎工作正常(但 YMMV).

Save and reload the project and the files should no longer be visible but accessible. I just did a quick test and it seemed to work fine (but YMMV).

这篇关于Visual Studio 2012 - 在解决方案资源管理器中隐藏文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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