Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Professional Visual Studio 2005 (2006) [eng]

.pdf
Скачиваний:
117
Добавлен:
16.08.2013
Размер:
21.9 Mб
Скачать

Contents

Chapter 43: Building Device Applications

593

Getting Started

593

.NET Compact Framework Versions

594

Solution Explorer

595

Design Skin

596

Orientation

596

Buttons

597

Toolbox

598

Common Controls

598

Mobile Controls

599

Debugging

605

Emulator

605

Device

606

Device Emulator Manager

607

Connecting

608

Cradling

608

Project Settings

609

Device Options

610

Summary

611

Chapter 44: Advanced Device Application Programming

613

Data Source

613

DataSet

615

ResultSet

623

Windows Mobile 5.0

623

SDK Download

623

Managed APIs

624

Notification Broker

626

Deployment

627

CAB Files

628

MSI Installer

629

OpenNetCF Smart Devices Framework

632

Summary

633

Part VIII: Build and Deployment

635

Chapter 45: Upgrading to Visual Studio 2005

637

The Upgrade Process

638

Getting Ready to Upgrade

638

Using the Upgrade Project Wizard

640

Checking the Upgrade Output

643

xxviii

 

Contents

The Upgrade Visual Basic 6 Tool

647

Summary

648

Chapter 46: Build Customization

649

General Build Options

649

Batch Building

652

Manual Dependencies

652

Visual Basic Compile Page

654

Advanced Compiler Settings

654

Build Events

656

C# Build Pages

657

Advanced

658

MSBuild

660

How Visual Studio Uses MSBuild

660

MSBuild Schema

663

Summary

664

Chapter 47: Deployment: ClickOnce and Other Methods

665

Installers

665

Building an Installer

665

Customizing the Installer

669

Adding Custom Actions

673

Web Project Installers

675

Service Installer

676

ClickOnce

677

Click to Deploy

678

Click to Update

683

Other Techniques

684

XCopy

684

Publish Website

684

Copy Web Project

684

Summary

685

Part IX: Debugging and Testing

687

Chapter 48: Using the Debugging Windows

689

Code Window

689

Breakpoints

689

DataTips

690

Breakpoint Window

690

xxix

Contents

Output Window

691

Immediate Window

692

Script Explorer

692

Watch Windows

693

QuickWatch

693

Watch Windows 1–4

694

Autos and Locals

694

Call Stack

694

Threads

695

Modules

695

Processes

696

Memory Windows

696

Memory Windows 1–4

696

Disassembly

697

Registers

697

Exceptions

698

Customizing the Exception Assistant

699

Unwinding an Exception

700

Summary

701

Chapter 49: Debugging Breakpoints

703

Breakpoints

703

Setting a Breakpoint

703

Adding Break Conditions

706

Working with Breakpoints

708

Tracepoints

709

Creating a Tracepoint

709

Tracepoint Actions

710

Execution Point

710

Stepping Through Code

711

Moving the Execution Point

712

Edit and Continue

712

Rude Edits

712

Stop Applying Changes

712

Summary

713

Chapter 50: Debugging Proxies and Visualizers

715

Attributes

715

DebuggerBrowsable

715

DebuggerDisplay

716

DebuggerHidden

717

xxx

 

Contents

DebuggerStepThrough

717

DebuggerNonUserCode

718

Type Proxies

718

The Full Picture

720

Visualizers

720

Advanced Techniques

723

Saving Changes to Your Object

723

Summary

723

Chapter 51: Maintaining Web Applications

725

Debugging

725

Breaking on Errors Automatically

727

Debugging an Executing Web Application

727

Error Handling

728

Tracing

729

Page-Level Tracing

729

Application-Level Tracing

731

Trace Output

731

Trace Viewer

732

Custom Trace Output

732

Summary

733

Chapter 52: Other Debugging Techniques

735

Debugging Options Pages

735

General Options

735

Debug Page in My Project

738

Exception Assistant

739

Debugging Macros

741

Debugging Database Stored Procedures

742

Summary

742

Chapter 53: Unit Testing

743

Your First Test Case

743

Test Attributes

748

Test Attributes

749

Asserting the Facts

750

Assert

751

StringAssert

751

CollectionAssert

752

ExpectedException Attribute

752

xxxi

Contents

Initializing and Cleaning Up

753

More Attributes

753

Testing Context

753

Data

754

Writing Test Output

755

Advanced

756

Custom Properties

756

Testing Private Members

758

Summary

760

Part X: Extensions for Visual Studio 2005

761

Chapter 54: InfoPath 2003 Toolkit

763

Creating Managed InfoPath Solutions

763

The Generated Solution

765

Switching Between Visual Studio and InfoPath

767

Adding Code to InfoPath Forms

768

Form-Related Events

768

Field Events

773

The Button Click Event

774

Other Considerations

776

Summary

776

Chapter 55: Visual Studio Tools for Office

777

The New Visual Studio Tools for Office

778

The Visual Designer

780

Control Design

781

Writing Code

782

The Actions Pane

784

Smart Tags

785

Microsoft Outlook Add-Ins

787

The VSTO 2005 Sample Project

788

Summary

800

Chapter 56: Visual Studio Team System

801

Team System Editions

801

For Everyone

801

For Software Architects

807

For Software Developers

811

For Software Testers

818

xxxii

 

Contents

Advanced

825

Writing Custom Code Analysis Rules

825

Customizing the Process Templates

828

Summary

830

Index

831

xxxiii

Introduction

Visual Studio 2005 is an enormous product no matter which way you look at it. Incorporating the latest advances in Microsoft’s premier programming languages, Visual Basic and C#, along with a host of improvements and new features in the user interface, it can be intimidating to both newcomers and experienced .NET developers.

Professional Visual Studio 2005 looks at every fundamental aspect of this new developer tool, showing you how to harness each feature and offering advice about how best to utilize the various components effectively. This book shows you the building blocks that make up Visual Studio 2005, breaking the user interface down into manageable chunks for you to understand.

It then expands on each of these components with additional details about exactly how it works both in isolation and in conjunction with other parts of Visual Studio to make your development efforts even more efficient.

Who This Book Is For

Professional Visual Studio 2005 is for all developers new to Visual Studio as well as those programmers who have some experience but want to learn about features they may have previously overlooked.

If you are familiar with the way previous versions of Visual Studio worked, you may want to skip Part I, which deals with the basic constructs that make up the user interface, and move on to the remainder of the book where the new features found in Visual Studio 2005 are discussed in detail.

If you’re just starting out, you’ll greatly benefit from the first part, where basic concepts are explained and you are introduced to the user interface and how to customize it to suit your own style.

This book does assume that you are familiar with the traditional programming model, and uses both the C# and Visual Basic languages to illustrate features within Visual Studio 2005. In addition, it is assumed that you can understand the code listings without an explanation of basic programming concepts in either language. If you’re new to programming and want to learn Visual Basic, please take a look at Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome. Similarly, if you are after a great book on C#, track down Beginning Visual C# 2005, written collaboratively by a host of authors.

What This Book Covers

Microsoft Visual Studio 2005 is arguably the most advanced integrated development environment (IDE) available for programmers today. It is based on a long history of programming languages and interfaces and has been influenced by many different iterations of the theme of development environments.

Introduction

The next few pages introduce you to Microsoft Visual Studio 2005, how it came about, and what it can do for you as a developer. If you’re already familiar with what Visual Studio is and how it came to be, you may want to skip ahead to the next chapter and dive into the various aspects of the integrated development environment itself.

A Brief History of Visual Studio

Microsoft has worked long and hard on their development tools. Actually, their first software product was a version of BASIC in 1975. Back then, programming languages were mainly interpretive languages in which the computer would process the code to be performed line by line. In the last three decades, programming has seen many advances, one of the biggest by far being development environments aimed at helping developers be efficient at producing applications in their chosen language and platform.

In the 32-bit computing era, Microsoft started releasing comprehensive development tools, commonly called IDEs (short for integrated development environments), that contained not just a compiler but also a host of other features to supplement it, including a context-sensitive editor and rudimentary IntelliSense features that helped programmers determine what they could and couldn’t do in a given situation. Along with these features came intuitive visual user interface designers with drag-and-drop functionality and associated tool windows that gave developers access to a variety of properties for the various components on a given window or user control.

Initially, these IDEs were different for each language, with Visual Basic being the most advanced in terms of the graphical designer and ease of use, and Visual C++ having the most power and flexibility. Under the banner of Visual Studio 6, the latest versions of these languages were released in one large development suite along with other “Visual” tools such as FoxPro and InterDev. However, it was obvious that each language still had a distinct environment in which to work, and as a result development solutions had to be in a specific language.

One Comprehensive Environment

When Microsoft first released Visual Studio .NET in 2002, it inherited many features and attributes of the various, disparate development tools the company had previously offered. Visual Basic 6, Visual InterDev, Visual C++, and other tools such as FoxPro all contributed to a development effort that the Microsoft development team mostly created on their own. They had some input from external groups, but Visual Studio .NET 2002 and .NET 1.0 were primarily founded on Microsoft’s own principles and goals.

The next version of Visual Studio was labeled Visual Studio .NET 2003 and focused on fixing bugs and the various issues that cropped up due to introducing such a radical new technology as the .NET Framework. The Framework itself was upgraded to 1.1 and the changes made to the IDE were similarly minor.

At this point, end users of Visual Studio and the various Microsoft-owned languages didn’t really get to help direct the shape of the programs, but only offer feedback about what was wrong, while Microsoft itself worked on internal issues developers had found with the first version of .NET.

However, at the same time, Microsoft announced that the next version of .NET, then code-named Whidbey, would be the “user’s .NET,” giving every developer using .NET the ability to submit feature requests and track issues as they progressed through the development cycle. Microsoft also worked

xxxvi

Introduction

closely with a large number of partners ensure that they were shaping .NET, and Visual Studio, of course, to be what the developer—that’s you—would most benefit from.

The result was the .NET Framework 2.0 and Visual Studio 2005, a set of development tools, editors, languages, and foundation framework classes that goes far beyond anything Microsoft has worked on previously. The Visual Studio 2005 development environment (see Figure I-1) takes the evolution of Microsoft IDEs a huge step further along the road to a comprehensive set of tools that can be used regardless of your purpose as a developer. A quick glance at Figure I-1 shows the cohesive way in which the various components fit together to provide you with an efficient toolset with everything easily accessible.

Figure I-1

Visual Studio 2005 comes in two main versions: Visual Studio 2005 Professional and Visual Studio 2005 Team System (to be accurate, there are three distinct flavors of Team System for different roles, but their core Visual Studio functionality remains the same). The majority of this book deals with the Professional Edition of Visual Studio 2005, but some parts utilize features found only in Team System. If you haven’t used Team System before, read through Chapter 56 for an introduction to the features it offers over and above the Professional Edition.

xxxvii