From the course: Visual Studio Tips and Techniques for Developers

Solution filters for customized project loading - Visual Studio Tutorial

From the course: Visual Studio Tips and Techniques for Developers

Start my 1-month free trial

Solution filters for customized project loading

- [Instructor] Do you work in Solutions with lots of projects? And so you might find that loading the project's individual studio can be slow. In this tip, we'll see how to use the new solution filter features available in Visual Studio 2019. I'm looking at my Solution Explorer. I can see that my Solution has seven projects. We've always had this ability to be able to right-click on a project and choose Unload Project. And now, the next time I opened this Solution it will load six of the seven projects. I can do multiple selections. I can Shift + click on these first three items and unload those. And then I'll unload this TipsLib. Now I've got two of my seven projects loading every time and Visual Studio remembers the setting. So when I go to File, Close Solution and then, reopen the Solution it remembers those settings and shows just the two projects. Now it's showing everything, but you can see everything's marked as unloaded except for these two. Now there's a new feature where I can right-click on this and choose to hide Unloaded Projects. So I get rid of the clutter inside Solution Explorer. And to bring those back, I can right-click and choose Show Unloaded Projects. This means you have full control over what you see in Solution Explorer. Now, another thing that I can do let's go back here and hide these is that I can then persist this view or this filter if you will by saving it as something called the Solution filter. So right-click here. And I say, Save as Solution Filter. And the extension on this is slnf, Solution Filter. Now I've already created one earlier called ConsoleOnly and I created another one called WebOnly. So I click here, choose to save, replace what I have. And now, when I go to close the Solution I've got several choices. I can open the sln file or this slnf file. So here's the VSTips one. Here is the ConsoleOnly. As I said, I've already saved another one which is where my web projects. So now I can go up here and choose this one called WebOnly. It loads in the three asp.net projects. So let's switch over to the ConsoleOnly Solution. I want to show you one other feature is both of these projects have a dependency on one of those other projects. So I have a dependency on TipsLibrary, but I forgot to load that in Solution Explorer. So what I can do is right-click here and choose to Load Direct Dependencies of Project or the Entire Dependency Tree. So I choose this one and it has TipsLib. And then also, here's another thing that it does, it notices that I was using a filtered solution. So it's asking me if I would like to update the slnf file. So if I click on this hyperlink here, it will do that. Now that means the next time I open it, let's go to the WebOnly. Here's the three web projects go back to the ConsoleOnly and it should load three items. The two Tips, Consoles and the TipsLib. To summarize, Solution Filter in Visual Studio allows us to select and save a custom subset of projects. This allows for faster solution loading, so each team member can quickly load what they need to start coding.

Contents