Visual Studio 2012 - Hide folders from solution browser?

Can I hide a folder in the Visual Studio 2012 Solution Browser window? I have several folders / files that I do not plan to use, and they just clutter up the interface and it is harder to find something.

It just seems rather illogical that you can switch "Show hidden files", but you cannot hide files.

Example

enter image description here

Why

The WebApi project includes the automatic creation of help, which I want to use, however it includes several folders that it needs to run. All I care about is the controllers / models, as I build Api myself. But if I delete / delete from the project these files than the generated generator will not work.

+6
source share
4 answers

Hiding folders is almost certainly a bad idea. Remember that hiding a folder is not the same as excluding it from the solution - all hidden elements can still be used elsewhere in the code that the assembly can reference and receive updates when you pull the latest version from the original control.

That's why it was never available for project folders, so people cannot easily confuse their workmates.

Having said that, you can hide folders at the solution level - I think, mainly because it is quite common to have documentation, shared libraries, etc. at this level. To hide the folder with the solution, right-click on the folder and select "Hide Folder" (to show, you must right-click on the solution itself and select "Show Folders")

enter image description here


As for your screenshot, where you want to hide Area , Scripts , etc. - I suspect that you are working alone and are just starting to learn MVC - otherwise it would be pointless to hide these folders. They contain legal code that is used to run the application. Hiding is the same as hiding Program.cs in a console project just for the reason that you prefer a smaller tree in the solution.

I agree that Solution Explorer becomes unmanageable at some point - but instead of ruining it, I would recommend trying other tools - Visual Studio "go to" options or Resharper (I use the latter).

+4
source

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

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

Create a new Visible child tag and set it to false .

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

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

+4
source

I don’t know if this is so in VS 2012, but in VS 2010 I just right-click on the folders (and, in some cases, files) that I don’t want and exclude them from the solution.

0
source

I'm not sure if this is a new feature, but you can hide folders from Solution Explorer without deleting or deleting them.

In VS 2017 (15.5.5) Just right-click on any solution folder and click on "Hide folder"

0
source

Source: https://habr.com/ru/post/950643/


All Articles