Visual Studio .NET - File Menu
(Page 4 of 10 )
The File menu provides access to a number of file, project, and solution-related commands. Many of these commands are content sensitive. Below are descriptions of those commands that are not self-explanatory.
New
As in most Windows applications, the New menu item creates new items to be worked on by the application. In Visual Studio .NET, the New menu item has three submenu items, to handle the different possibilities. They are:
Project...(Ctrl+Shift+N)
The Project command brings up the New Project dialog, which is context-sensi-tive. If there is no project currently open, as is sometimes the case when Visual Studio .NET is just opened, you will see the dialog box shown in Figure 2-2.
If there is already a project open, then you will get the New Project dialog box shown in Figure 2-5. This dialog box adds radio buttons to give you the choice of adding the new project to the solution, or closing the existing solution and creating a new one to hold the new project.

Figure 2-5. New Project dialog box from menu
Notice the two image buttons at the top right of the dialog box: these allow you to display the templates in either large or small icons.
File...(Ctrl+N)
The File command brings up a New File dialog box, as shown in Figure 2-6. It offers three different categories of files and many different types of files (templates) within each category. Files created this way are located by default in the project directory (although you can browse for a different location). They are displayed in the Solution Explorer if the Show All button is toggled, but they are not actually part of the solution unless explicitly added by using one of the Add menu items described later in this chapter. In other words, they are the miscellaneous files described previously in the section, “Projects and Solutions.”
Blank Solution...
The Blank Solution command also brings up a New Project dialog similar to that shown in Figure 2-5, with the Add to Solution radio button grayed out, the default Project Type set to Visual Studio Solutions, and the Template set to Blank Solution. When a blank solution is created, it contains no items. Items can be added using one of the Add menu items described later in this section.
The New command has an equivalent button in the Standard toolbar, which exposes the New Project and Blank Solution commands.

Figure 2-6. New File dialog box
Open The Open menu item is used to open preexisting items. It has four submenu items:
Project...(Ctrl+Shift+O)
Opens a previously existing project. The currently opened solution is closed before the new project is opened.
Project From Web...
An Open Project From Web dialog box is presented, which accepts a URL pointing to the project to open. As with Open Project, the currently opened solution is closed before the new project is opened.
File...(Ctrl+O)
Presents a standard Open File dialog box, allowing you to browse to and open any file accessible on your network. Files opened are visible and editable in Visual Studio .NET, but are not part of the project. To make a file part of the project, use one of the Add menu commands described later in this chapter. The Open File command has an equivalent button on the Standard toolbar.
File From Web...
An Open File From Web dialog box is presented which accepts a URL pointing to the file to open. As with Open File, the file selected is not made part of the project.
Add New Item . . . (Ctrl+Shift+A) Add New Item allows you to add a new item to the current project. It presents the Add New Item dialog box shown in Figure 2-7. Expanding the nodes in the Categories pane on the left side of the dialog box narrows the list of Templates shown on the right side.

Figure 2-7. Add New Item dialog box
This is the menu item to use if you want to add new files to your project, including new source code files. For source code, you would typically add a new Class file, which will automatically have the language-specific filename extension.
This command has an equivalent button in the Standard toolbar. It is also accessible from the context menu in the Solution Explorer.
Add Existing Item . . . (Shift+Alt+A) Add Existing Item is very similar to the Add New Item menu item just described, except that it adds already existing items to the current project. If the item added resides outside the project directory, a copy is made and placed in the project directory.
This menu option is also available from the context menus in the Solution Explorer.
Add Project Add Project has three submenus. The first two, New Project and Existing Project, allows you to add either a new or preexisting project to the solution. The third, Existing Project From Web, presents a dialog box that accepts the URL of the project to be added.
Open Solution Clicking on this menu item brings up the Open Solution dialog box, which allows you to browse for the solution to open. The currently open solution will be closed before the new solution is opened.
Close Solution This menu item is only available if there a solution is currently open. If this menu item is selected, the currently open solution will be closed.
Advanced Save Options . . . Advanced Save Options is a context-sensitive submenu that is only visible when editing in a code window. It presents a dialog box, which allows you to set the encoding option and line ending character(s) for the file.
Source Control The Source Control submenu item allows you to interact with your source control program.
This article is excerpted from Programming ASP.NET by Jesse Liberty and Dan Hurwitz(O'Reilly, 2003; ISBN 0596004877). Check it out at your favorite bookstore today. Buy this book now. |
Next: Edit Menu >>
More ASP.NET Articles
More By O'Reilly Media