The Solution Explorer supports different management actions depending on whether you are currently interacting with a solution or a project. In fact, supported commands might vary by project type as well. As an example, the Copy Web Project command button is available for web projects but not class library projects, whereas the Properties command button is available for all item types.
There are two primary interfaces for interaction within Solution Explorer: the toolbar and the context menu. Let’s review the primary features.
Table 5.3 shows the various buttons hosted in the Solution Explorer’s toolbar, along with their specific scope.
Clicking the solution in Solution Explorer immediately exposes all the valid management commands for that solution. As stated earlier, you access these commands through either the Solution Explorer toolbar or the context menu for the solution (which you access by right-clicking the solution). Through the toolbar and the solution’s context menu, the Solution Explorer allows you to do the following:
View and set the properties for a solution
Build/rebuild a solution
Directly launch the configuration manager for a solution
Set project dependencies and build order
Add any of the various Visual Studio-supported solution and project items
Run code analysis against all the files in the solution
View code metrics for all the files in the solution
Add the solution to the source control
You can initiate some of these actions by using the Solution Explorer toolbar; you can access the balance in the context menu for a solution, as shown in Figure 5.2.
Just as with solutions, Solution Explorer provides various ways to manage projects within a solution, including the following:
Opening a project item
Building or rebuilding a project
Adding items to a project
Adding a reference to a project
Cutting, pasting, renaming, or deleting a project within the solution tree
Running code analysis against all the files in the project
Viewing code metrics for all the files in the project
Unloading a project
Limiting the scope of the Solution Explorer to a single project
Launching a separate instance of the Solution Explorer window scoped to a single project
Note
The current startup project for a solution is indicated with a bold font (as is the OrderEntry
project in Figure 5.1). If multiple projects are selected as startup projects, the solution name is instead bolded.
Figure 5.3 shows the project context menu for a class library project.
The default action when you double-click an item is to open it within its default editor or designer. Multiple select and drag-and-drop operations are also supported. For instance, multiselecting several code files allows you to open them simultaneously in their editor windows either by right-clicking or typing the Enter key.
You can move and copy items within a solution, within a project, or between projects through the standard drag and drop using the left mouse button. You can also drag certain items from within a project and drop them onto a suitable designer surface. This is an easy way, for instance, to add classes to a class diagram: simply highlight the code files that contain the types you want to add and drag them onto the class diagram designer window.