How to load/unload multiple projects in a solution? - visual-studio-2010

We have around 50 projects in our solution and that's a big time drain. The load/unload project feature is great help but the process is slow and tedious since there is so many projects and many dependencies between them.
I would like to have project 'templates' or 'presets'. For example, I want to work on project D and that means that projects A, B and C have to be loaded and everything else unloaded. If I want to work on project W that means that all projects from A to W have to be loaded.
Is this possible? The active 'template' would usually change few times per day.

You have at least three options:
Use Solution Folders. These allow you to unload/reload projects in a group. Just create a Solution Folder, move a few projects there, and use the 'Unload Projects in Solution Folder' context menu item.
Use Macros. There are examples that do exactly that.
[Hacky/Speculation] The unloaded projects list is stored in the .suo file, so it might be convenient to create several .suo files and switch between the configurations by overwriting the original one.
Here is the original blog post from an ex-Microsoft employee having the same issues and solutions.

Visual Studio 2019 has a new concept called "Solution Filter Files".
https://learn.microsoft.com/en-us/visualstudio/ide/filtered-solutions?view=vs-2019
You can right click on a solution after you've unloaded what you want and do "Save as solution filter". It creates a file which is a list of projects to INCLUDE in opening. So if a new project is added, I don't think it would be picked up.
Another important feature to note is the right click "Show unloaded projects" and the right click "Hide unloaded projects".
FYI - The file looks like this:
{
"solution": {
"path": "IvaraDotNet.sln",
"projects": [
"AssetManagement\\StaticLoad\\AssetManagementStaticLoad.vcxproj",
....
"framework\\oqpersman\\oqpersman.vcxproj"
]
}
}

Related

Visual Studio 2013 - navigating among many projects

Complex solutions usually contains several projects.
Currently I have more than 30 projects in a solution.
Some of the projects could contain many files inside (up to 1000 or more).
So when you open files from different projects all this stuff is expanded.
So if I want to find some file using solution explorer I need to scroll forever until it will be found.
Of course it is possible to navigate to it using Resharper's Ctrl+T but this is not related to those files you don't remember names but remember in which project and in which folder it is located.
I've tried to find some extension which could create tabs from projects but unfortunately unsuccessfully.
So is there any way to effectively navigate in such scenarios?
Some ideas:
Organize files into folders so that you don't have more than a few folders open when working on any given feature
Forget files; instead, navigate to class by name. Ctrl+, is the default shortcut.
Use F12 to go to definition; this also avoids having to find the file.
Search by keyword. Ctrl+Shift+F finds in all files. You just need to remember something from the file; it doesn't have to be the file name.
Enable "Track Active Item in Solution Explorer" in Options / Projects & Solutions / General. This keeps the file that is being edited selected in the solution explorer (but does lead to lots of folders expanding all the time).
Conversely, disable "Track Active Item", then you'll be in charge of what folders are expanded. Try both, see which one works best.
Use Solution Folders, which enable you to place several projects into a folder.

Eclipse Luna: Remove certain projects from Navigator?

I'm wondering how/if I can remove certain projects from the navigator menu in Eclipse? I'm in uni and I have multiple projects with similar names because of how I have to name files for labs, and it gets cluttered having so many projects showing. I was wondering if there was a way to remove them from the navigator without actually deleting them, that way I could hide the ones from last semester.
The Navigator view is old one. You can hide some predefined resources from it but not projects.
Better use Project explorer/Package explorer view.
First close the projects you want to hide in Project explorer/Package explorer view then refer this blog to hide them
Note that closing the projects also makes eclipse to work faster.

merging multiple projects into one project in solution

Is it possible to create solution in which I'll have some projects of Class Library type, and another one merging project, that will be Class Library containing source of all other projects in solution ?
It's possible to share code files between projects by adding them as a link in the additional projects. I use this technique to share copies of PetaPoco, common AssemblyInfo files, etc. between my projects. You could possibly use this technique to do what you want.
To do this, add and create the code files you want to the first project as you normally would. Then, in the projects in which you want to use an existing code file:
Right-click the project in Visual Studio Solution Explorer.
Choose Add -> Existing item...
Choose the code file that already exists, but on the Add button click the down arrow and choose "Add as Link" instead.
Now anytime you make changes to the original file, it will be reflected in all the other projects in which you added that file as a link.
Hope this helps.

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.

Add a folder structure to a Visual Studio Solution

Is it possible to add a folder structure to Solution Items without manually adding each level of the tree?
We have a multi project solution which requires several third-party libraries, at least one of which has a multi-layer tree.
We have a libs folder at the solution root level, alongside all the other projects.
The answers regarding Show Hidden Files, etc. don't work for solution items, only within a project.
Is there any way to get around this?
Do we have to add them folder by folder if we want them at the solution level?
(A similar question has been answered many times regarding Visual Studio projects. However my question is about Visual Studio solutions.)
Solution folders are just logical groupings of items. I don't think they relate to the file structure on your system. That is why you don't see them with a "Show hidden files" sort of functionality. You must right-click the solution, add a new folder, and then right click on the folder to add existing items or nested folders.
Not quite an answer to the question, but to view folders on the file system within Visual Studio Solution Explorer there is now a way of switching views between the solution and the folders. Here is the button to switch:
Clicking/tapping on this brings up "Solution Explorer - Views" content showing all available solution files and option for "Folder View":
Double clicking the "Folder View" shows the folders in the underlying file system:
Screen shots taken with Visual Studio 2019 16.10 preview 4, but this has been there for a while now.
I was looking for something similar and came across this thread. I had several data files that I wanted included with my solution but weren't specific to any one project in that solution.
I'm using VS 2019 and discovered they now have "Shared Projects" in C#, VB and C++ flavors. These projects don't build anything, but it's a convenient way to include some related directories/files.
Add a new Shared Project to your solution with the desired directory name.
Copy all your secondary files to the new directory.
Select "Show All Files" in the Solution Explorer.
Select the files, then right-click and select "Include in Project".
You can now view the file structure and open the files as part of your VS solution but VS will not try to build anything for that Shared Project.
If you have Source Control enabled, VS will also check-in those files (unless you mark them as excluded).
One option is to add an extension: "Add Folder as Solution Folder"
With this extension you can do this:
right click the solution > Add > Add Folder as Solution Folder
If I get you right, you'd like to have the projects organized in your solution.
Not sure if this fit your scenario, but if you choose a ".sln" (switch file-extension in the filebrowser-Dialog) when adding existing projects to your actual solution it will add all the project organized as they are saved in the sln to add.
(VS2017)
PS: Yes, I see this is a 7 Years old post :)
One Option would be to write a little exe and add this as external Tool to VS. Basically you would need to edit the sln file (plain text) by adding the folders as "Projects"
...
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "mycsproj", "
[somerelativepath]\mycsproj.csproj", "{projGUID}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FolderName",
"FolderName", "{FolderGUID}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SubFolderName",
"SubFolderName", "{SubFolderGUID}"
EndProject
...
{FAE04..} shall be the Project Type GUID for CSproject
{2150...} would be the Project Type GUID for Project Folder
And define the hierarchy in the section
...
GlobalSection(NestedProjects) = preSolution
{projGUID} = {SubFolderGUID}
{SubFolderGUID} = {FolderGUID}
EndGlobalSection
...
Now it's up to you to write some exe, reading the folder info of the libs from the disk and write according Project-Folder Infos in the sln. This should not be a huge effort :)
So whenever you collect multiple projects to your solution, you hit your ext tool and have the connected projects structured fine.
And still I might be on a false track understanding your issue:)

Resources