How do I hide projects? - visual-studio

I have a large VS solution, but I'm only working on two different projects, but need all the projects loaded to do the build. I cannot change the structure of the solution.
Is it possible to hide the projects I'm not working on? They would still build, and be accessible when needed, but I'm getting tired of scrolling up and down in Solution Explorer.
If it's not possible, but work-arounds are available?

You can right click a project --> "New solution explorer view" and then you can play with the windowconfiguration like this:

I do it like this:
Right click solution | Add New Solution Folder
Then I just create some dummy folder. I drag all the projects and anything else I do not want to see into that folder.
Then right click the folder | Hide Folder
Note: If you work in a team environment, do not check in the solution file.
It works for me so hopefully it will work for you as well.
If only I could create a folder and throw some of the people I can think of into it and do the above trick...

for anyone looking for a way to do this, take a look at the "filtered solutions" feature of vs2019. worked pretty good for me and my team. enjoy.
https://learn.microsoft.com/en-us/visualstudio/ide/filtered-solutions?view=vs-2019

Related

IntelliJ IDEA folders instead of packages in project view

Is it possible in IntelliJ IDEA to show folders instead of packages in project view? There is such a feature in Eclipse: we can just switch from "package explorer" to "project explorer" and here we go.
To make it more clear:
I want to see packages as hierarchy of folders.
I wanna see this:
but instead I see this:
Yes you can switch "View as" from Packages to Project.
For expanding folders uncheck Compact Empty Middle Packages
Simple, follow these steps and you should able to resolve the issue
Then
Done :-)
You can do it by going to options menu, please follow the below images.( This is not that much useful)

How do I show the References folder in Solution Explorer without selecting 'Show All Files' in a VB.NET project?

As I compare many C# example projects to my VB.NET projects, I see that the References folder shows in the Solution Explorer without having to select "Show All Files". Is it possible to have this for a VB.NET project as well? I find that it would be very helpful to have this folder displayed without having to see all the other hidden files as well.
I'm using VS2010 Professional.
This adds to my list of reasons why I should have learned C# first...
I guess I will have to definitively crush your dream. Sorry. It has been a decision by Microsoft to remove this from the default view to reduce the 'clutter'. However, your 'Show All Files' setting will persist when you save your project. So if you show all files once and then save, then it will always be on.
You can also see your References in the Project designer, which you can always keep open in a tab.
As of Visual Studio 2015, this behavior has been changed to show the References folder without selecting Show All Files.
From MSDN:
What’s new is the References node. This used to be hidden and you had to click Show All Files to see it—but that also showed lots of irrelevant files.
This previous behavior might have made sense 10 years ago when you’d start with a Windows Forms project and it would generally have the right set of references. But it’s a reality of modern development nowadays that the References node is used frequently—especially to manage NuGet references. It’s a small but handy convenience to be able to find it easily in Solution Explorer.
I add a separate folder called Dependencies, add my dll's to it and check them in as described here. That way my dll's are always visible in the Solution explorer without having to turn on Show All Files.
Select 'Show All Files option' in the solution explorer.

I open up a Design.csproj and a whole solution opens!

Why?
I expect only the project to open.
The only way that I could accomplish what I wanted to do was to create a new project test.csproj, add design.csproj, save the solution, and then remove test.csproj.
In Tools > Options > Projects and Solutions > General, there is a checkbox, labeled "Always show solution".
With this option checked, opening a project from within the folder stucture of a solution will still open the whole solution. If you click only the project, I believe the IDE finds the solution by simply traversing the parent directories for the .sln file.
The reason I say that is because if you copy the directory containing a single project and paste it somewhere else, then double click it, the project is opened on its own (still inside a solution, but a temporary one, which only exists as an .suo file for now (until you save the solution.))
So we are halfway there. Now if you uncheck the option which I mentioned at the start of my post, you will see the project open on its own like so:
I agree that it should be possible to open a project without a solution (and that it should be easier than it is currently.) I'd go as far as to say that VS should also give you the option to easily make and run programs in a single file without all the hand-holding and creating projects and solutions for you. Perhaps you can, but if so - it's not obvious.
Maybe because you have "Open most recent solution" in Options?
Maybe it was a Solution file (sln), wrongly labeled as a C# Project File (csproj).
If you open the file in a Text Editor you'll see references to other projects, like in a solution file.
Projects are linked to solutions; you cannot open a project without its parent solution.
Otherwise, things like project references wouldn't work.

Visual Studio: How to build only some projects

My VS solution has many projects.
I am currently only working on some of them so I want CTRL+SHIFT+B to only build some.
What's the best way to do it?
I thought about creating a new configuration but I would need to check it in and it does not seem right. I don't care if it will be only a "local" setting on my machine.
Right-click on the Solution and choose "Configuration Manager". Un-check the "Build" columns for each one you don't want built.
Creating a new configuration would be the best way to do it.
Alternately, create a second solution file and only add the projects you're interested in. We've done that for a few of our enterprise products where a full solution would load dozens of projects. The main reason we did this is to cut down on the resources that VS uses. Name the solution something like "My Product - minimal build". You have the option of checking it in or not.
Go to the solution explorer (CTRL+SHIFT+L for me), mark the projects you want to build, right-click them (SHIFT+F10 if you are a keyboard aficionado) and select "Build Selection"
Look into the solution explorer - right click the projects you don't want to build and unload them
Simply right click on the project you want to build in Solution Explorer, and select Build.
It will build that project only (including referenced projects).

Adding a new project to an existing solution in TFS

I added a project to an existing solution that is currently under source control using TFS, but for some reason I cannot check in the new project. When I view my pending changes, none of the files in the new project show up. None of the files have a plus (for a new file) next to them. What did I do wrong? How do I fix it? It's time to check in.
The problem is the solution has lost its binding. That's why it's not checking out automatically when you add the new project.
In order to restore the binding in VS 2010, go to File->Source Control->Change Source Control. Look for the "Solution: your solution name" and if it's not bound it will say "no server". Click on it and then click "Bind" from the toolbar.
in Visual Studio 2012/2013 it's File->Source Control->Advanced->Change Source Control (Thanks to danglund).
This should create a new vssscc file that is correctly bound. Now add the new project and everything should work correctly.
I was also having the same problem, this is how I fixed it:
Go to Visual Studion: File->Source Control->Change Source Control
Find your project there, its status would be "Invalid", Click on it and press "Unbind". Now go back to Solution Explorer and Remove your project. Add this project again into the solution explorer solve the problem.
Good Luck!
Click on the Team Project name in Source Control Explorer
File -> Source Control -> Add Items to Folder...
Follow the wizard.
Head over to Source Control Explorer and browse to the place in the tree which matches where the new project is at for your solution. Add the files there.
However, I'd be concerned that you modified the solution file and it didn't ask you to check that out. What you may want to try doing is manually checking out the solution file, then readding the project to the solution and seeing if it takes then.
You shouldn't need to drop to the command line - this is a pretty straightforward operation.
Open the solution. Select the project (make sure it is in the solution).
File -> Source Control -> Properties will bring up the binding dialog.
Bind the project to source control.
You should now see + signs next to all your files. The key is that that a .vssscc is added for your project to version control.
If that fails, open your csproj in notepad (after making a backup), and ensure any version control bindings are removed, then try again.
Unfortunately, I'd wager that your best bet is to manually do the check-ins through the command line. I've ran into situations where the Team Explorer UI grows out of sync with what's actually happening in source control, and manually fixing things through tf.exe was the only way to resolve it.
That said, normally, adding a new project to a solution isn't a hassle.
TFS can simply do not know about your project existed. Just add your project files through Source Control Explorer and re-load the solution.
While loading of a solution it can ask you to bind your project to source control. Let it do so by clicking Bind button - it should do all the magic for you.
Make sure you get the latest version of the solution
Check out the solution file
Add the new project
If the newly added project was previously under (another) source control, that might mess things up, make sure to "unbind" it before adding it. (See source control bindings somewhere under the "file" menu in Visual Studio)
You shouldn't need the command line.
I had this same problem in VS 2019, where I had added a new project to an existing solution, and the project wasn't showing up in pending changes. Right-clicking on the project and going to Source Control only had an option to "Add Solution to Source Control".
Using the above answers, I started down the File --> Source Control path, which then yielded an option to directly "Add selected projects to source control". Taking that option solved the problem, so that now the new project shows up in pending changes. NOTE: I'm adding this answer since it's still an issue in VS 2019, but has an easier solution now than in the past.

Resources