Set Sail with Visual Studio .NET
Visual Studio .NET isn't just another pretty face: It's fully .NET-enabled and speaks several new languages. Here are some of its most important new development and database features.
January 23, 2002
Look beneath the surface at some developing changes
Visual Studio .NET is probably the most significant milestone in the evolution of Microsoft's graphical development environment since Visual Studio (VS) 1.0. Visual Studio .NET isn't just an IDE face-lift with a few new productivity tools thrown in. One look at Visual Studio .NET reveals that the new product is a marked departure from any previous version of VS. The changes aren't just skin deep; the UI enhancements are just the tip of the iceberg. The changes below the surface let you use Visual Studio .NET to develop Microsoft .NET applications. These changes include support for the C# and Visual C++ (VC++) languages, support for the radical enhancements to Visual Basic (VB) embodied in the Visual Basic .NET language, integrated support for a new programming model called XML Web services, and integrated support for the new .NET class framework.
Microsoft has released four versions of Visual Studio .NET:
Visual Studio .NET Enterprise Architect (VSEA)
Visual Studio .NET Enterprise Developer (VSED)
Visual Studio .NET Professional
Visual Studio .NET Academic
VSEA is the superset of all the other versions. All the versions provide the same core IDE; the ability to use C#, Visual Basic .NET, and C++; and the ability to create Web services and generate handheld applications. In addition to the core development features, VSEA enables central control over a group of developers, letting a lead project architect set rules and policies and create templates for developers to use. VSEA also includes a copy of BizTalk Server Developer Edition and design tools that use Unified Modeling Language (UML) to map out application designs.
VSED is a subset of VSEA but a superset of Visual Studio .NET Professional. Besides the core development features found in the other editions, VSED includes the developer editions of Windows 2000 Server, SQL Server 2000, Commerce Server 2000, Host Integration Server 2000, and Exchange 2000 Server. It also includes Visual SourceSafe and the Visual Database tools.
Visual Studio .NET Professional and Visual Studio .NET Academic both include the core Visual Studio .NET development languages and tools. However, Visual Studio .NET Academic has some additional features for course management and generating student applications. Now, let's take a tour of the most important new features you can find in the Visual Studio .NET enterprise editions, including some database-integration features that Microsoft added for .NET developers.
The Tip of the Iceberg
VS has always been a developer's best friend, and Visual Studio .NET is no exception. The enhancements available in Visual Studio .NET bring it a new level of sophistication and customization. The release of Visual Studio .NET also marks the first time Microsoft has provided a common IDE for all its development environments. You'll appreciate this change if you've worked with more than one of the earlier VS development tools, which required you to learn a different UI and IDE for each language.
When you start Visual Studio .NET, you'll find the Start Page that Figure 1 shows. The Visual Studio .NET environment assumes that your Internet connection is always available; many of the links displayed on the Start Page connect directly to Microsoft's Web site. When Visual Studio .NET first starts up, links under the Get Started label show your most recent projects. Selecting What's New will display the latest Visual Studio downloads and updates on Microsoft's Web site. The Online Community option links to a list of Microsoft's .NET newsgroups. The Headlines link takes you to a collection of .NET technical articles on the Microsoft site. The Search Online link displays the Microsoft Developer Network (MSDN) Search page. You can find links to Visual Studio .NET code samples, add-ins, and guided walkthroughs under Downloads. For a list of the Web services that you can incorporate into your own applications, select the XML Web services link. The Web Hosting link displays a list of sites that you can use for testing your Web service applications. Finally, the My Profile page that Figure 1 shows displays a set of options that you can use to customize the operation of the IDE. You can use My Profile to choose between the default Visual Studio .NET settings and settings that more closely resemble VB 6.0 or VC++.
Opening a new Visual Basic .NET Windows Application project and beginning a new form displays the Visual Studio .NET IDE that Figure 2 shows. Visual Studio .NET still provides the familiar IDE features that were a mainstay of previous versions. These familiar features include the Code Editing window with color-coded keywords; the Design window, which lets you visually create your UI by dragging components from the Toolbox window; and the familiar Solution Explorer and Class View windows, which show the files and class hierarchy in the project. An Object Browser displays an object's properties and methods, and a To Do window tracks upcoming tasks that need to be performed for the solution. In addition, in Visual Studio .NET enterprise editions, the IDE is tightly integrated with the new version of Visual SourceSafe, the source-code version-control system that Microsoft bundled with Visual Studio .NET.
Although the Visual Studio .NET development environment retains many familiar features, it also introduces several entirely new aspects. The tabbed child windows, for example, make navigating between open windows a breeze. The Code Editing window also has the ability to outline, a feature that lets you collapse multiple lines of code under one line. This ability is particularly useful when you want your new Visual Basic .NET project to more closely resemble VB 6.0 modules.
Figure 3 shows another new feature, the Server Explorer window. You can use Server Explorer to browse available database and Web servers that are accessible to your development system. You can even drag tables and other result setreturning database objects from Server Explorer onto your Design window; Visual Studio .NET will automatically create all the data-connectivity code and display the selected data in a grid. I cover how to use Server Explorer with SQL Server later in this article.
Visual Studio .NET still has all the vital features that made earlier versions such a productive environment, and a host of new features make the IDE more productive and more customizable. First, the IDE has a new look. For the drop-down menu displays, transparent activation turns each option a light blue when the option is selectable. Microsoft also took pains to provide more usable screen real estate by using autohiding windows. For example, by default, the Toolbox and Server Explorer windows both dock and hide on the left side of the IDE. You can make the hidden windows slide out and display by moving the mouse over the window's vertical title bar, which remains displayed even when the window is retracted. Moving the mouse off the window hides the window. Visual Studio .NET doesn't lock you into a set usage for the various windows in the IDE. You have complete control of the windows and can set them to be dockable, hidden, or floating.
Customizability is a major theme with the new Visual Studio .NET IDE, and nowhere is this more evident than in the new support for editing and debugging macros. These macros let you customize the use of the Visual Studio .NET IDE and automate repetitive tasks. The Visual Studio .NET IDE is fully scriptable and macro-enabled, so you can construct macros to perform any task that can be performed interactively. Closely related to Visual Studio .NET's macros feature is the ability to customize the keyboard layout and assign macros to hot keys. You can also create customized IDE extensions called add-ins, which perform automated or repetitive tasks. Add-ins are compiled programs you create in Visual Basic .NET, C#, or managed C++ that add functionality to the Visual Studio .NET IDE.
Another closely related feature is the new command window that you display by using the View, Other Commands, Command Window option. You can use the command window to directly execute IDE commands—bypassing the menu system—or to evaluate commands by preceding them with a question mark. As when you're editing lines of code directly in the IDE's code-editing window, the command window provides full Intellisense autocompletion for the commands you enter. This feature makes entering code much easier because the IDE displays the required code syntax and prompts you for the required parameter values.
In addition to these major enhancements, the IDE also includes several smaller but useful functions. For example, you can invoke a new incremental search option by pressing Ctrl+I and then typing a text string. The incremental search positions the cursor to the matching text string in the code-editing window. As you type more characters, the search continues to reposition the cursor in the Code Editing window to the first string that matches the incremental search value. Pressing Ctrl+Shift+I repeats the incremental search, using the current search value. Like Microsoft Office XP, Visual Studio .NET now includes a clipboard ring that stores the last 20 copied selections, which lets you paste from multiple buffer items. And a new box-selection feature lets you select columns by using the Alt key in combination with the mouse.
But the changes to the IDE aren't just limited to the editing environment. Microsoft also added a Dynamic Help feature. To invoke Dynamic Help, position your cursor on an item in the Code Editing window, then select the Dynamic Help option from the Help menu. A docked window displayed in the lower right corner of the IDE contains links to relevant Help topics. These links include the typical online syntax Help as well as links to samples and documentation links.
Below the Surface
The productivity enhancements in Visual Studio .NET are extensive, but the most significant changes by far lie beneath the IDE in the foundation that Visual Studio .NET builds on: the .NET Framework. The .NET Framework provides a runtime engine and a set of classes that you can use to develop applications. The central part of the .NET Framework is the Common Language Runtime (CLR), which all .NET languages share. The .NET Framework provides the underlying support for several new application types, including WinForms, WebForms, and Web services. As you'd expect, you use WinForms for Windows applications and WebForms for Web applications; Web services are a distributed Web-application building-block component. To develop these new application types, you use the various namespaces (collections of classes) that the .NET Framework provides. The .NET Framework is essentially composed of the CLR and the class libraries that the applications use. Figure 4, page 35, shows a simplified overview of the .NET Framework and its relationship to Visual Studio .NET.
You can use Visual Studio .NET or any other text editor to write the source code for .NET applications. In Visual Studio .NET parlance, these collections of source code are called solutions. To access system, network, Web, and database resources, the .NET applications include references to the appropriate namespaces. For example, the System.IO namespace contains classes that you use to read and write to the OS, and the System.Windows.Forms namespace contains classes you use to create and display Windows applications. The System.Web namespace contains classes you can use to create ASP.NET Web applications, and the five System.Data namespaces contain classes that are used for ADO.NET database-access applications.
The .NET Framework compiler then combines your source code and the .NET class references into an object called an assembly. An assembly is an .exe or .dll file that contains the Intermediate Language (IL) code along with metadata that identifies the version of the application and all the components the application uses. Including this metadata in the assembly frees .NET applications from any reliance on the registry to locate DLLs and other application components. This metadata effectively puts an end to DLL Hell because it provides exact information about the components that are used in the assembly, including names, versions, and locations.
When a user or application executes an assembly, the CLR parses it, discovering the executable components. The CLR then takes the IL code from the assembly and uses its just-in-time (JIT) compiler to convert the IL into native code that the OS executes. The CLR provides memory management, thread management, and application security.
In addition to the .NET Framework, Microsoft has released the .NET Framework software development kit (SDK). Essentially, the .NET Framework SDK provides Microsoft's .NET languages and compilers (Visual Basic .NET, Visual C#, and VC++) while Visual Studio .NET provides the designers and tools to create applications that use those .NET languages. For an overview of the .NET Framework, see the sidebar "Visual Studio .NET and the Microsoft .NET Framework SDK," page 34.
Database Features
Even with all this .NET development, Microsoft hasn't forgotten the database developer. Visual Studio .NET provides better database-integration tools than any previous version of VS. These new management tools help make Visual Studio .NET Microsoft's most productive database application-development platform ever.
Figure 3 shows the first new database feature you'll discover—Server Explorer, which replaces the Data Environment. You can add a SQL Server system to Server Explorer by right-clicking Data Connections in the Server Explorer window and selecting the Add Connection option. Server Explorer provides many of the same database-management capabilities that you'll find in SQL Server 2000's Enterprise Manager and Query Analyzer. Right-clicking the database object displays a menu that lets you retrieve data into a grid, start the Table Designer, create a trigger, generate an object-creation script, delete the object, or export the data to a flat file. Visual Studio .NET's Retrieve Data function is a surprisingly useful option that lets you quickly browse the contents of a table or view. Figure 5 shows an example of Visual Studio .NET's data-retrieval feature.
Like Enterprise Manager's Database Diagrams, Visual Studio .NET's Database Designer feature helps you visualize or create a database and its relationships. To create a new database diagram, right-click the Database Diagrams object in Server Explorer and select New Diagram from the pop-up menu. When you save the diagram, Database Designer creates all the database objects represented in the diagram.
Another new database feature in Visual Studio .NET is the T-SQL script-generation feature that you can use to build a creation script for an entire database or a single database object. To use this tool, you need to have the SQL Server client tools installed on the same system as Visual Studio .NET. You can generate database-object creation scripts by right-clicking a given database object in the Server Explorer window, then selecting Generate Create Script from the pop-up menu.
Visual Studio .NET's Table Designer is another SQL Server management function that Microsoft has incorporated into Server Explorer. The Table Designer option, which looks almost like the Table Designer in Enterprise Manager, lets you create a new table or change an existing table's schema. To invoke the Visual Studio .NET Table Designer, right-click Server Explorer's Tables collection, then select New Table from the pop-up menu.
Visual Studio .NET also includes a new graphical Query and View Designer modeled after the one in SQL Server. To use the Query and View Designer, you drag tables onto the design environment, then define links, set selection criteria, and select columns to create a query or view. You start the Query and View Designer by right-clicking Server Explorer's Views collection and selecting the New View option from the pop-up menu.
The .NET Effect
Visual Studio .NET is a huge evolutionary step for Visual Studio. One primary goal of Visual Studio .NET is to simplify Web-application development, and the product succeeds admirably in that goal. The Visual Studio .NET WebForms feature makes programming ASP.NET Web pages almost as easy as developing standard desktop applications. In addition, the new IDE productivity features provide a level of customization and scriptability that Visual Studio never had before. Although much of Visual Studio .NET, especially the new database-integration features, builds on previous technologies, the overall result is the most significant version of Visual Studio that Microsoft has ever released.
About the Author
You May Also Like