Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I hide files from Solution Explorer by name in VS2015?

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:

.dropbox.attr files

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:

.dropbox.attr context menu

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?

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.

like image 288
dlras2 Avatar asked May 11 '15 18:05

dlras2


People also ask

How do I hide Solution Explorer in Visual Studio?

At least in Visual studio 2015 and 2017 there is a command Window. AutoHide that does the trick for already docked panels. It is the same as menu:Window->Auto hide all and it autohides all panels in the same stack. Either use standard menu command Alt W A respective Alt W U or give it a shortcut of its own.

How do I show all files in Solution Explorer?

Select the project in Solution Explorer. 4. Click "Show All Files".


2 Answers

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>

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.

like image 118
Corneliu Avatar answered Sep 20 '22 17:09

Corneliu


In a DNX project in visual Studio 2015 the solution explorer does not use the project.json to determine what is shown. The "exclude" properties in project.json are used by dnx to determine which folders/files should be excluded from compilation or publishing but this does not affect Visual Studio's solution explorer.

Generally speaking "everything" is shown but that isn't exactly true as VS excludes certain folders (such as .git, .vs, artifacts, etc). It also adds back others (i.e. bower components is excluded by default from compilation but VS adds it back as a meta folder under dependencies). The "filter" for Solution Explorer is not exposed to the user so it can't be edited or changed by configuration file.

Your best bet would be to request via user voice that some method of configuration be added. Really the functionality is already there it just needs to be made customizable by the user.

like image 32
Gerald Davis Avatar answered Sep 17 '22 17:09

Gerald Davis