|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Introduction to the IDE (Visual C#)
The Visual C# integrated development environment (IDE) is a collection of development tools exposed through a common user interface. Some of the tools are shared with other Visual Studio languages, and some, such as the C# compiler, are unique to Visual C#. The documentation in this section provides an overview of how to use the most important Visual C# tools as you work in the IDE in various phases of the development process.
If you are developing an ASP.NET 2.0 Web application, you will be using the Visual Web Developer IDE, which is a fully integrated part of Visual Studio 2005. However, if your code-behind pages are in Visual C#, then you will be using the Visual C# Code Editor within Visual Web Developer. Therefore, some topics in this section, such as, might not be completely applicable to Web applications.
Visual C# Tools
The following are the most important tools and windows in Visual C#. The windows for most of these tools can be opened from the View menu.
The Code Editor, for writing source code.
The C# compiler, for converting C# source code into an executable program.
The Visual Studio debugger, for testing your program.
The Toolbox and Designer, for rapid development of user interfaces using the mouse.
Solution Explorer, for viewing and managing project files and settings.
Project Designer, for configuring compiler options, deployment paths, resources, and more.
Class View, for navigating through source code according to types, not files.
Properties Window, for configuring properties and events on controls in your user interface.
Object Browser, for viewing the methods and classes available in dynamic link libraries including .NET Framework assemblies and COM objects.
Document Explorer, for browsing and searching product documentation on your local machine and on the Internet.
How the IDE Exposes the Tools
You interact with the tools through windows, menus, property pages, and wizards in the IDE. The basic IDE looks something like this:
You can quickly access any open tool windows or files by pressing CTRL + TAB. For more information, see.
Editor and Windows Form Designer Windows
The large main window is used by both the Code Editor and the Windows Forms Designer. You can toggle between code view and Design view by pressing F7, or clicking Code or Designer on the View menu. While in Design view, you can drag controls onto the window from the Toolbox, which you can make visible by clicking on the Toolbox tab on the left margin. For more information about the Code Editor, see. For more information about the Windows Forms Designer, see .
The Properties window in the lower right is populated only in Design view. It enables you to set properties and hook up events for user interface controls such as buttons, text boxes, and so on. When you set this window to Auto Hide, it will collapse into the right margin whenever you switch to Code View. For more information about the Properties window and the Designer, see.
Solution Explorer and Project Designer
The window in the top right is Solution Explorer, which shows all the files in your project in a hierarchical tree view. When you use the Project menu to add new files to your project, you will see them reflected in Solution Explorer. In addition to files, Solution Explorer also displays your project settings, and references to external libraries required by your application.
The Project Designer property pages are accessed by right-clicking on the Properties node in Solution Explorer, and then clicking Open. Use these pages to modify build options, security requirements, deployment details, and many other project properties. For more information about Solution Explorer and the Project Designer, see.
Compiler, Debugger, and Error List Windows
The C# compiler has no window because it is not an interactive tool, but you can set compiler options in the Project Designer. When you click Build on the Build menu, the C# compiler is invoked by the IDE. If the build is successful, the status pane displays a Build Succeeded message. If there were build errors, the Error List window appears below the editor/designer window with a list of errors. Double-click an error to go to the problem line in your source code. Press F1 to see Help documentation for the highlighted error.
The debugger has various windows that display values of variables and type information as your application is running. You can use the Code Editor window while debugging to specify a line at which to pause execution in the debugger, and to step through code one line at a time. For more information, see.
Customizing the IDE
All of the windows in Visual C# can be made dockable or floating, hidden or visible, or can be moved to new locations. To change the behavior of a window, click the down arrow or push-pin icons on the title bar and select from among the available options. To move a docked window to a new docked location, drag the title bar until the window dropper icons appear. While holding down the left mouse button, move the mouse pointer over the icon at the new location. Position the pointer over the left, right, top or bottom icons to dock the window on the specified side. Position the pointer over the middle icon to make the window a tabbed window. As you position the pointer, a blue semi-transparent rectangle appears, which indicates where the window will be docked in the new location.
You can customize many other aspects of the IDE by clicking Options on the Tools menu. For more information, see.