Use solution explorer window of Visual Studio

Visual Studio Solution Explorer

1 – Basic and useful functionnalities

undefined Sync with Active Document : Allow you to select/find in solution explorer the active/displayed document.

undefined Collapse All : Allow you to collapse all projects and folders in solution.

undefined Show All Files : Allow you to show all files, even those hidden.

undefined Search Solution Explorer : Allow you to search files/folders.

undefined Properties : Show item (file, folder, class, project, etc.) properties.

2 – Project, solution briefly !

A project is a container of; a part of your application’s code and assets ! A solution is a container that’s used by Visual Studio to organize one or more related code projects.

A C# project information (you can have other languages projects like VB, JavaScript, etc.) are stored in a *.csproj file while a solution in *.sln

When you create a new project automatically Visual Studio will create a solution for you ! You can also create a solution and add existing or new project to that latter in Visual Studio ! See also : using .NET CLI commands, About projects and solutions and Actions and tips

3 – Right click options !

You can right click any item in Solution Explorer and see what options are possible. Evry item a, solution, project, class or file/folder, will have different options. For example :

Solution / Project : Build, Rebuild, Clean, Open Folder in File Explorer, Add, Manage NuGet Packages.

Solution : Configuration Manager, Restore NuGet Packages.

Project : Debug > Start New Instance, Set as Startup Project, Unload/Load Project, Edit Project File, Manage User Secrets.

Class / File : Exclude From Project, Include In Project (use Show All Files to see all hidden and not included items), Open Containing Folder.

4 – Properties Window

Properties Window F4

Here i’m talking about Properties Window that’s usually placed at the bottom of the Explorer Solution window. For solutions and projects this window will not show a lot of information because they have a special properties windows that are opened by default when you select Properties option.

For simple items like files you will have Advanced tab that contains important options : Build Action, Copy to Output Directory (and Custom Tool if needed).

When you add/create a code file (class, interface, etc.) you don’t need to worry about those options but when you add other files (assets) like image, documents, resources (*.resx), you will need to change at least Build Action (and maybe Copy to Output Directory) otherwise your items will not be readable by the compiler and will be ignored or won’t be part of your built or deployed application if you want so. E.g. : “Do not copy” option for Copy to Output Directory doesn’t mean that your file won’t be part of your app but rather, won’t be copied to your build and generally files other than assets (images, templates, …etc.) don’t need to be copied.