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

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

问题描述

我正在使用ASP.NET Preview模板在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="wwwroot\jspm_packages\" />
    <DnxInvisibleFolder Include="wwwroot\node_modules\" />

    <DnxInvisibleContent Include="wwwroot\tsd.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天全站免登陆