Visual Studio 2005 Features


In this section, we'll present an overview of the Visual Studio 2005 feature set. We'll look at some of these features in more detail in the next few chapters of the book. Here we'll define some common terms that we can use to describe the different parts of the IDE. Visual Studio 2005 is a fairly large and complex product. The terms used to describe the IDE are helpful for developers who are working to understand the tool and, perhaps more important, for developers who will eventually extend the IDE through macros and add-ins.

Editors, Designers, and Tool Windows

The windows in the Visual Studio 2005 IDE fall into two major groups. Document windows are windows that usually appear tabbed in the center of the IDE and that contain editors, designers, Web pages, or Help topics. Tool windows are windows in the IDE that present utility functions to the programmer. The tool windows include Solution Explorer, the Class View window, and the Properties window. Tool windows are distinct from editors and designers in the way they dock around the sides of the IDE.

Note 

The extensibility API built into Visual Studio 2005 allows programmers to create tool windows for use with language packages installed into the IDE. The editors and designers in the IDE can be accessed through this API, but the extensibility model doesn't allow the creation of new document window types. For that you'll need to look into the Visual Studio software development kit (SDK), which we'll describe at the end of this chapter.

Figure 1-2 shows a typical developer setup.

image from book
Figure 1-2: A typical solution in Visual Studio 2005

The Start Page

The first time you run Visual Studio 2005, you're presented with a Start Page, which contains links to previously opened projects and information relevant to the preferred collection of settings for the developer type chosen the first time the IDE is opened. A settings collection is a window, keyboard, and Help layout that's tailored to a specific type of programmer. You're presented with a choice of settings when you first run Visual Studio 2005. You can change the settings that you want to run under by opening the Import and Export Settings Wizard, available from the Tools menu. This wizard allows you to back up and to transfer your settings and customization between computers. You can use this wizard to reset your settings by choosing Reset All Settings, as shown in Figure 1-3.

image from book
Figure 1-3: Resetting the IDE in the Import and Export Setting Wizard

Figure 1-4 shows the initial settings you can choose from in Visual Studio 2005.

image from book
Figure 1-4: Choose from a number of different setting collections to begin to customize the IDE.

In Chapter 6, we'll discuss customizing the IDE and saving your settings as a backup or for reuse on other computers.

The Editor

In talking with members of the team that developed the base editor in Visual Studio 2005, it's clear that they understand that programmers live in the editor. It's where the most important programming work is done. To this end, the Visual Studio team has continued to work hard to create a code editor that's one of the best available today. To a great extent, they have succeeded in this goal, largely because of enhancements to the extensibility features of the IDE. These enhancements include an extremely powerful extensibility programming model, a macro recording facility, and a dedicated Macros IDE. The Visual Studio 2005 extensibility model is a major focus of the book because it's what we use to customize and to add functionality to the IDE.

Other features in the editor include code snippets, smart tags, change tracking, outlining, line numbering, and a really outstanding search-and-replace facility, all of which are discussed in detail in Chapter 3.

A new feature in Visual Studio 2005 allows you to tab through your open documents and tool windows by pressing Ctrl+Tab. In Figure 1-5, you can see the dialog box that appears when you press this combination. You can use the arrow keys or the Tab key to move through the listed windows as you hold down the Ctrl key.

image from book
Figure 1-5: Use Ctrl + Tab to get a list of open windows in the IDE.

Designers

Visual Studio 2005 offers four major types of designers: Windows Forms designers, which let you create Windows Forms applications visually; Web Forms designers, which help you create WYSIWYG ASP.NET Web Forms applications; the Component Designer, which is used to build server-side components for enterprise solutions; and the XML Designer, which makes it easy for programmers to work with XML Schema Definition files.

In Visual Studio 2005, all languages provide designers for .NET application creation. This means that you can design your Windows Forms and Web Forms in the same language you use to write your most important algorithms. In the past, it was common for developers to create the front end of their applications by using a visual tool such as Visual Basic and to write the back end in Visual C++. Because of the way that .NET assemblies interoperate, you're still free to do your forms layout and library writing in different languages, but you're no longer forced to work that way.

Tool Windows

Tool windows are the nondocument windows in the IDE that provide you with information and utility functionality as you work. The IDE has a large number of tool windows, and you can access them easily using keyboard shortcuts, the Command Window, and menu commands. The following are the most commonly used tool windows in Visual Studio 2005. These tool windows are presented with their associated default keyboard shortcuts.

Solution Explorer (Ctrl+Alt+L) The Solution Explorer window is arguably the most important tool window in Visual Studio 2005. In Visual Studio 2005, nearly all the work done by a programmer revolves around a solution. A solution is a collection of projects, which are themselves collections of files. It's through Solution Explorer that you'll get access to the files in your projects. Here you'll add new classes and files to projects and even new projects to larger solutions. Figure 1-6 shows a project in the Solution Explorer tool window.

image from book
Figure 1-6: A ScreenSaver Starter Kit project in Solution Explorer

Class View (Ctrl+Shift+C) The Class View window provides you with a logical view of the classes in your solution. If you're working with larger projects, you might find it easier to navigate through your solutions by using Class View than by using Solution Explorer. Figure 1-7 shows the solution from Figure 1-6 in Class View.

image from book
Figure 1-7: The Class View window gives you an alternative view of the objects in your solution.

Properties (F4) In the Properties window, you can get and set properties for the user interface items that you add to Windows Forms and Web Forms applications. You can also use this window to set properties for solutions, projects, and files that you have selected in Solution Explorer. Figure 1-8 shows the Properties window for a project.

image from book
Figure 1-8: You can use the Properties window to set properties of components, projects, and solutions.

Server Explorer (Ctrl+Alt+S) You use the Server Explorer window to access data sources and information on your local machine and on remote servers. Through this window, you can make data connections, access performance counters and event logs, and even manage system services. Even when used locally, this tool can save you a great deal of time, letting you easily start and stop system services that you're testing and access system logs. In Figure 1-9, you can see two machines available in Server Explorer. The first machine is a remote test server. The second machine is the local machine on which Visual Studio 2005 is running.

Note 

Keep in mind that you'll need the proper level of access on a particular server to access system information.

image from book
Figure 1-9: The Server Explorer window provides you with remote access to the machines you're working with.

Toolbox (Ctrl+Alt+X) The Visual Studio 2005 Toolbox window is used to hold the controls that you add to your Windows Forms and Web Forms applications. You can see the Common Controls in the Toolbox in Figure 1-10.

image from book
Figure 1-10: The Toolbox window gives you access to controls and code snippets.

Command Window (Ctrl+Alt+A) The Command Window combines some of the best features of the Immediate window from Visual Basic 6 with the power of a command line. Chapter 2 covers the Command Window in detail. You use the Command Window to enter and execute named commands directly in Visual Studio 2005. A named command is essentially any IDE command that you can run through a menu, toolbar button, or shortcut. Many of the named commands in Visual Studio 2005 aren't mapped to a keystroke or available through a menu by default. The only way to access these commands without mapping them or adding them to a toolbar is to type them directly into the Command Window.

In Visual Studio 2003, the Command Window had two modes of operation. In Command mode, the window acts as a command-line tool. In Immediate mode, the Command Window is used for debugging. In Immediate mode, you can execute statements, change variables and print their values, and evaluate expressions. In Visual Studio 2005, these two modes are broken into separate tool windows, making it very easy to switch between the two. To get to the Immediate mode tab from Command mode, type immed. This will open an Immediate Window tab, allowing you to execute debugging statements. To get back to the Command mode tab from Immediate mode, type >cmd.

Tip 

In Command mode, the > prompt will be visible on the line where you're typing your commands. Immediate mode shows no prompt.

Figure 1-11 shows the Command Window.

image from book
Figure 1-11: The Command Window in Visual Studio 2005 provides easy access to named commands in the IDE.

Macro Explorer (Alt+F8) The Macro Explorer window provides a view of the macro projects that are currently loaded in the IDE. Keep in mind that a macro project needs to be loaded in order for the macros in the project to be available for use or for editing in the Macros IDE.

When you record a temporary macro by pressing Ctrl+Shift+R, that macro becomes available through the MyMacros\Recording Module\TemporaryMacro item in Macro Explorer. You can rename the temporary macro to save it, or you can copy the code from the macro into another module in the Macros IDE. We'll discuss using recorded macros in more detail in Chapter 5. The Macro Explorer window is shown in Figure 1-12.

image from book
Figure 1-12: Macro Explorer gives you easy access to the macros available for use.

The IDE has a number of other important windows, which we'll talk about more fully in the next couple of chapters. Among these are the various debugging windows, the Help windows, and the Object Browser.

Visual Studio 2005 File Paths

In this section, we'll tell you a little bit about where Visual Studio 2005 places its important files. We'll cover this subject in more detail throughout the book, where it applies, but for now you should be aware of the locations of the files that you can manipulate to enhance the IDE and make automation a bit easier. The default base folder for the Visual Studio 2005 installation is \Program Files\Microsoft Visual Studio 8. Most of the folders we'll talk about in this section are subfolders under the Microsoft Visual Studio 8 folder (unless we provide the full path).

Installing Visual Studio 2005 also installs the .NET Framework SDK in the SDK\v2.0 subfolder. All the .NET Framework tools and samples are available in this folder, so it's a good place to start digging around if you're just getting to know .NET. Check out the StartHere.htm file in the SDK\v2.0 folder for the full story on the .NET Framework SDK.

The various languages that ship with Visual Studio 2005 all have their own subfolders that contain the project and solution templates for their respective project types. These folders are all named appropriately. Visual C++–specific files are found in VC, C#-specific files are in VC#, and Visual Basic 2005 files are in VB. In Visual Studio 2003, we used these folders to create and add custom projects to the various languages in the IDE. In Visual Studio 2005, you can store your templates in the My Documents\Visual Studio 2005 folder. This makes it much easier for you to find and extend these project types in addion to making it easier to run as a non-administrator on your workstation.

Tip 

You'll notice a file named Samples.vsmacros in the Common7\IDE folder. The sample macros for Visual Studio 2005 that run in your IDE are actually stored in your My Documents\ Visual Studio\ Projects\VSMacros80 folder. The version in the IDE folder is a backup copy. You can edit the Samples.vsmacros file in your My Documents\Visual Studio\Projects\ VSMacros80\Samples folder, but try to keep the version in your IDE folder clean. If you ever run into a macro corruption problem, you can usually copy the Samples.vsmacros file from your IDE folder to your VSMacros folder to get rid of the problem.

The IDE executable itself is Devenv.exe. This file is also available in the Common7\IDE subfolder. The IDE folder contains a number of subfolders that you'll be using throughout the book. These folders include the PublicAssemblies and PrivateAssemblies folders, which you'll use to add custom assemblies that are available to macros in the IDE. You'll use the HTML folder to customize the Start Page. The templates for the macro projects are stored in the MacroProjectItems and MacroProjects folders. Generic item templates (those not associated with a particular project type) are stored in the NewFileItems and NewScriptItems folders.

image from book
Adding an IDE Folder Shortcut to Your Tools Menu

If you do a lot of extensibility work, you might want to add a shortcut to the IDE folder to your Visual Studio 2005 Tools menu. To do this, follow these steps:

  1. Press Ctrl+Alt+A to open the Command Window, and then type Tools.External Tools, or click External Tool in the Tools menu. This will open the External Tools dialog box.

  2. Click Add to add a new tool to the menu, and type IDE Folder as the Title.

  3. In the Command text box, type Explorer.exe.

  4. In the Arguments text box, add the path to your Visual Studio 2005 IDE subfolder. (This is usually C:\Program Files\Microsoft Visual Studio 8\Common7\IDE.) Click OK.

If all of that works, your IDE folder should open when you choose IDE Folder from the Tools menu. We'll use the External Tools feature to create some more time-saving shortcuts later in the book.

image from book

If you do command-line builds or if you simply like to work from the command line, you'll want to set environmental variables for Visual Studio 2005 when you launch Cmd.exe. You have a couple of options for setting these variables. First, you can simply open the Start menu and choose the Visual Studio 2005 Command Prompt. You'll find that command prompt in the Visual Studio 2005 Tools folder, which is in the Microsoft Visual Studio 8 folder.

Tip 

We suggest pinning the Visual Studio 2005 Command Prompt link to the Start menu so that you'll have easy access to it as your primary command prompt.

The Visual Studio environmental variables are available in a file named vsvars32.bat, which is in the Common7\Tools subfolder. If you want access to these variables from every instance of Cmd.exe on your machine, you can add C:\Program Files\Microsoft Visual Studio 8\Common7\Tools to your system path. (Alternatively, you can copy this file to a folder in your path.) Then you can just type vsvars32 from any command prompt and you'll have a Visual Studio 2005 working environment from your current command prompt.

You can take this one step further by creating a Command item on the Tools menu. You create a new menu item from the External Tools dialog box by clicking Add, making the Title of the new item Command Prompt, and making the Command item cmd.exe. If you want, you can set the Initial Directory box to $(ProjectDir). Setting the Initial Directory to your project directory will open the command prompt to that directory. This can make it very convenient to work with your project files from the command line.

Finally, consider adding the Common7\IDE path to your system variables. The full path is C:\Program Files\Microsoft Visual Studio 8\Common7\IDE. This will make Devenv.exe available from any command prompt on your system. This path is added by the vsvars32.bat command, but sometimes you need access just to Devenv.exe.

Tip 

Consider using Devenv over Notepad when you're editing files for command-line builds. Even though you might not get access to the build and project facility without a solution, you still have access to your custom tools and to your macros.




Working with Microsoft Visual Studio 2005
Working with Microsoft Visual Studio 2005
ISBN: 0735623155
EAN: 2147483647
Year: 2006
Pages: 100

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net