如何在 VS2015 中按名称从解决方案资源管理器中隐藏文件? [英] How can I hide files from Solution Explorer by name in VS2015?

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

问题描述

我正在使用 ASP.NET 预览模板在 VS2015 中编写网站.不幸的是,Dropbox 在我的项目的每个文件夹中添加了一堆 .dropbox.attr 文件,解决方案资源管理器正在显示这些文件:

I am writing a website in VS2015 using the ASP.NET Preview template. Unfortunately, Dropbox has added a bunch of .dropbox.attr files in each folder of my project, which the Solution Explorer is displaying:

请注意,我没有手动将它们添加到项目中(在我的 Web.xproj 中没有引用它们),并且我没有选择显示所有文件".我已经将它们添加到我的 .gitignore 中.选择文件时没有删除"选项:

Note that I have not added them to the project manually, (they are not referenced in my Web.xproj,) and I do not have "Show All Files" selected. I have already added them to my .gitignore. There is no "Remove" option when selecting the file:

最后,我尝试将它们添加到我的 project.json 的排除部分:

Lastly, I have tried adding them to my project.json's exclude section:

...

"publishExclude": [
    "node_modules",
    "bower_components",
    "**.xproj",
    "**.user",
    "**.vspscc",
    ".dropbox.attr"
],

"exclude": [
    "wwwroot",
    "node_modules",
    "bower_components",
    ".dropbox.attr"
]

...

有什么办法可以让所有具有此名称的文件不出现在我的解决方案资源管理器中?

Is there any way to get all files with this name to not appear in my Solution Explorer?

我不确定 VS2015 与新项目结构之间的相互作用,所以这可能是任何这些因素的结果.

I'm not sure exactly of the interaction between VS2015 and the new project structure, so it could be a result of any of those factors.

推荐答案

您可以修改项目的 .xproj 文件并添加以下内容以排除文件夹:

You can modify the .xproj file of your project and add the following to exclude folders:

<ItemGroup>
    <DnxInvisibleFolder Include="wwwrootjspm_packages" />
    <DnxInvisibleFolder Include="wwwroot
ode_modules" />

    <DnxInvisibleContent Include="wwwroot	sd.json" />
</ItemGroup>

您可以对文件夹使用 DnxInvisibleFolder,对文件使用 DnxInvisibleContent.某些文件夹(如 node_modules)有时有数千个文件夹/文件,这似乎对 VS2015 扫描和加载构成了重大问题.

You can use DnxInvisibleFolder for folders and DnxInvisibleContent for files. Some folders (like node_modules) have sometimes thousands of folders/files which seem to pose a major problem for VS2015 to scan and load.

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

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