1. Trang chủ
  2. » Giáo án - Bài giảng

professional visual studio

915 326 0
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Tiêu đề Professional Visual Studio
Tác giả Andrew Parsons, Nick Randolph
Trường học Not specified
Chuyên ngành Not specified
Thể loại Not specified
Năm xuất bản 2005
Thành phố Not specified
Định dạng
Số trang 915
Dung lượng 20,88 MB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

The Add-In Manager 425 Types of Add-Ins 426 Creating a Simple Add-In with the Wizard 427 Common Classes, Objects, and Methods 432 Development Environment Enhancements 439 The Card Game S

Trang 2

Andrew Parsons and Nick Randolph

Trang 4

Professional

Trang 6

Andrew Parsons and Nick Randolph

Trang 7

Professional Visual Studio ® 2005

Copyright © 2006 by Wiley Publishing, Inc., Indianapolis, Indiana

Published simultaneously in Canada

1 Microsoft Visual studio 2 Microsoft NET Framework 3 Web site development—Computer programs

4 Application software—Development—Computer programs I Randolph, Nick 1978- II Title.TK5105.8885.M57P38 2006

LIMIT OF LIABILITY/DISCLAIMER OF WARRANTY: THE PUBLISHER AND THE AUTHOR MAKE NO SENTATIONS OR WARRANTIES WITH RESPECT TO THE ACCURACY OR COMPLETENESS OF THE CON-TENTS OF THIS WORK AND SPECIFICALLY DISCLAIM ALL WARRANTIES, INCLUDING WITHOUTLIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE NO WARRANTY MAY BE CREATED

REPRE-OR EXTENDED BY SALES REPRE-OR PROMOTIONAL MATERIALS THE ADVICE AND STRATEGIES CONTAINEDHEREIN MAY NOT BE SUITABLE FOR EVERY SITUATION THIS WORK IS SOLD WITH THE UNDERSTAND-ING THAT THE PUBLISHER IS NOT ENGAGED IN RENDERING LEGAL, ACCOUNTING, OR OTHER PROFES-SIONAL SERVICES IF PROFESSIONAL ASSISTANCE IS REQUIRED, THE SERVICES OF A COMPETENTPROFESSIONAL PERSON SHOULD BE SOUGHT NEITHER THE PUBLISHER NOR THE AUTHOR SHALL BELIABLE FOR DAMAGES ARISING HEREFROM THE FACT THAT AN ORGANIZATION OR WEBSITE ISREFERRED TO IN THIS WORK AS A CITATION AND/OR A POTENTIAL SOURCE OF FURTHER INFORMA-TION DOES NOT MEAN THAT THE AUTHOR OR THE PUBLISHER ENDORSES THE INFORMATION THEORGANIZATION OR WEBSITE MAY PROVIDE OR RECOMMENDATIONS IT MAY MAKE FURTHER, READ-ERS SHOULD BE AWARE THAT INTERNET WEBSITES LISTED IN THIS WORK MAY HAVE CHANGED OR DIS-APPEARED BETWEEN WHEN THIS WORK WAS WRITTEN AND WHEN IT IS READ

For general information on our other products and services please contact our Customer Care Department within theUnited States at (800) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002

T

Trra ademarrk kss:: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are

trademarks or registered trademarks of John Wiley & Sons, Inc and/or its affiliates, in the United States and othercountries, and may not be used without written permission Visual Studio is a registered trademark of MicrosoftCorporation in the United States and/or other countries All other trademarks are the property of their respectiveowners Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book

Trang 8

Quality Control Technicians

John GreenoughLeeann Harney

Project Coordinator

Adrienne Martinez

Media Development Specialists

Angela DennyKit MaloneTravis Silvers

Proofreading and Indexing

Techbooks

Trang 10

About the Authors

Andrew Parsons

Andrew Parsons is an accomplished programmer, journalist, and author He created, launched, and

served as chief editor for Australian Developer magazine, which was so successful that it expanded ally and is now known as International Developer Subsequent to that success, Parsons launched the local Australian and New Zealand edition of MSDN magazine In addition, he has written a variety of techni-

glob-cal books, including topics as diverse as HTML and CSS, Photoshop, and Visual Basic Express When notwriting, Parsons consults on NET programming implementations for a number of clients, and currentlyserves as a senior consultant at Readify Pty, Ltd (www.readify.net), as well as running his own busi-ness, Parsons Designs (www.parsonsdesigns.com), and GAMEparents (www.gameparents.com), awebsite dedicated to helping parents understand and enjoy computer and video games

Nick Randolph

Nick Randolph is an experienced NET developer and solution architect During his time with SoftwareEngineering Australia, a not-for-profit industry body, Nick founded the Perth NET Community of Practiceand has been integrally involved in the local NET community since When Nick joined AutumnCare(www.autumncare.com.au) as Development Manager, he was responsible for their product architecture,which incorporated best practices around building smart client applications using the NET Framework.Nick is currently a solutions architect with SoftTeq (http://softteq.com), which provides consulting,training, and mentoring services Outside of his consulting role, Nick takes a proactive approach towardtechnology, ever seeking to learn, use, and present on beta products As a Microsoft MVP, Nick has beeninvited to present at IT conferences such as TechEd, MEDC, and Code Camp, and has been a worldwidefinalist judge for the Microsoft Imagine Cup for the last two years

Trang 12

Andrew Parsons

First, I want to thank the team at Wrox for putting their trust in me yet again to write a book for theirtechnical series Without the encouragement of Katie Mohr, Brian Herrmann, and the rest of the teamwho often remain faceless in these things, I doubt that this book would have made it to completion.Brian, thanks for continuing to kick my butt to “get it done.”

Next, I have to say thanks to my author Nick Randolph, who volunteered to jump on board and write this book with me, was always available for helpful about how to illustrate the finer points, andmost definitely kept his end of the bargain going, flying across the country to work with me at the tailend of the project to make sure we had everything important covered Nick and I have worked togetherpreviously on much smaller projects and it was a delight to discover how focused and organized he iswhen tackling something as big as this book

co-Of course, everyone needs their critics and technical support, and I benefited greatly from advice fromAndrew Coates, Frank Arrigo, and Charles Sterling from Microsoft, as well as Mitch Denny, Greg Low,and Darren Neimke, all from Readify (www.readify.net)

On a much more personal note, I most definitely need to thank my family Even more so than my lastbook, my beautiful wife, Glenda, put up with my highs and lows over the months it took to write thisbook, and was without question the biggest supporter I had throughout the process My kids amazed mewith their maturity, letting their dad spend night after night locked away in his office They seemed torealize how important it was for me to concentrate, and often left me to it when they could (justifiably)have demanded more of my time I love both of them very much and am looking forward to spending

“oodles and oodles” of time with them

Nick Randolph

Writing this book was one of the more challenging projects that I’ve embarked on—in particular, the cess of getting started and putting the first words onto paper A massive thank you has to go to my gor-geous partner, Meg, who not only put up with me ranting and raving over the “cool feature” that I wascurrently writing about, but also encouraged me to think logically and never lose sight of the endgame.This being my first book, I would especially like to thank everyone at Wiley who has helped me throughthe learning phase—in particular, Brian Herrmann, who put up with some dreadful writing sins when Iwas getting started, and Katie Mohr (whose ability to get us back on track was a life-saver), who madethe whole process possible

Trang 13

pro-I have to pass on a big thank you to my co-author, Andrew Parsons, who invited me to join him in ing this book Despite our completely different work hours, Andrew managed to coordinate the wholeprocess I also have to thank him for ensuring that information flowed between the various stakeholdersand that we achieved the key milestones.

writ-Lastly, I would like to thank all of my fellow developer MVPs (Mitch Denny, Greg Low, Bill McCarthy)and the Microsoft staff (Dave Glover, Charles Sterling, Andrew Coates), who were always able to answerany questions along the way

Trang 14

How This Book Is Structured xxxviii What You Need to Use This Book xxxix Conventions xxxix

p2p.wrox.com xli

Trang 15

Chapter 3: The Toolbox 29

Describing the Toolbox 29 Arranging Components 31 Adding Components 33 Commonly Used Elements 35

Solution Explorer Structure 39 Showing Hidden Items 40 Temporary Solutions 41 Web Solutions 42 Common Project and Solution Tasks 43

Tool Window Customization 49

Importing and Exporting IDE Settings 55 Splitting Up the Workspace 57

The Form Itself 59 Form Design Preferences 63 Adding Controls to Your Form 64

Trang 16

Solution Structure 79 Solution File Format 81 Solution Properties 81

Project Types 84 Project File Format 84 Project Properties 84

Selecting a Source Control Repository 98

Accessing Source Control 99

Trang 17

Pending Changes 102

Source Control with Team Foundation 105

Resourcing Your Application 125 What Are Resources? 127

Trang 18

Accessing Specifics 133

Coding Resource Files 134

Custom Resources 136

What Are XML Comments? 155 How to Add XML Comments 156 XML Comment Tags 156

Trang 19

The <exception> Tag 159

Trang 20

Taking Charge of the Class Designer 189

Object Test Bench 191

Applying Cryptography 204

Trang 21

Obfuscating Your Code 222

Code Snippets Revealed 243

Trang 23

Property Accessibility 299 Custom Events 300

What Is the My Namespace? 314 The Main Components 315 Using My in Code 316

Trang 24

My.Forms and My.WebServices 325

My For the Web 325 My.Resources 325 Other My Classes 327

Data Source Connection Wizard 357 SQL Server Format 362 In-Code Construction 363 Encrypting Connection Strings 364

Trang 25

Chapter 28: Assembly Signing 367

Strong-Named Assemblies 367 The Global Assembly Cache 368 Signing an Assembly in VS 2005 368

Smart Compile Auto Correction 371 Customizing Warnings in Visual Basic 374

Customizing Warnings in C# 380

DataSet Overview 383 Adding a Data Source 384 DataSet Designer 387 Working with Data Sources 390

Trang 26

The Add-In Manager 425 Types of Add-Ins 426 Creating a Simple Add-In with the Wizard 427 Common Classes, Objects, and Methods 432

Development Environment Enhancements 439

The Card Game Starter Kit 450 The Screensaver Starter Kit 451 The Movie Collection Starter Kit 452 The Personal Web Site Starter Kit 453 Creating Your Own Starter Kit 454

Visual Studio 2005 Windows 457

Trang 28

Introducing Find and Replace 479

Find and Replace Options 489

The Servers Node 492

Database Windows in Visual Studio 2005 507

Trang 29

Using Databases 518

Managing Test Data 524 Previewing Data 525 Database Projects 526

Where Can Regular Expressions Be Used? 530

What Are Regular Expressions? 532

Regular Expression Syntax 534 Regular Expressions in NET Programming 536

Trang 30

Creating Web Projects 551

Web Development Options 556

Website Menu 558 Web Controls 558

Finalizing and Deployment 569

Web Development Revisited 577

Trang 31

Chapter 43: Building Device Applications 593

The Upgrade Process 638

Trang 32

The Upgrade Visual Basic 6 Tool 647

General Build Options 649

Visual Basic Compile Page 654

Breakpoint Window 690

Trang 33

Output Window 691 Immediate Window 692 Script Explorer 692 Watch Windows 693

Execution Point 710

Edit and Continue 712

Trang 34

Debugging Options Pages 735

Debug Page in My Project 738 Exception Assistant 739 Debugging Macros 741 Debugging Database Stored Procedures 742

Your First Test Case 743

Trang 35

Initializing and Cleaning Up 753

Creating Managed InfoPath Solutions 763

Adding Code to InfoPath Forms 768

The New Visual Studio Tools for Office 778 The Visual Designer 780

Team System Editions 801

Trang 36

xxxiii

Trang 38

Visual Studio 2005 is an enormous product no matter which way you look at it Incorporating the latestadvances in Microsoft’s premier programming languages, Visual Basic and C#, along with a host ofimprovements and new features in the user interface, it can be intimidating to both newcomers andexperienced 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 componentseffectively This book shows you the building blocks that make up Visual Studio 2005, breaking the userinterface 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 inisolation and in conjunction with other parts of Visual Studio to make your development efforts evenmore 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 ofthe 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 explainedand 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 theC# and Visual Basic languages to illustrate features within Visual Studio 2005 In addition, it is assumedthat you can understand the code listings without an explanation of basic programming concepts ineither 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 interfacesand has been influenced by many different iterations of the theme of development environments

Trang 39

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 integrateddevelopment 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 inwhich the computer would process the code to be performed line by line In the last three decades, pro-gramming has seen many advances, one of the biggest by far being development environments aimed athelping developers be efficient at producing applications in their chosen language and platform

In the 32-bit computing era, Microsoft started releasing comprehensive development tools, commonlycalled IDEs (short for integrated development environments), that contained not just a compiler but also ahost of other features to supplement it, including a context-sensitive editor and rudimentary IntelliSensefeatures that helped programmers determine what they could and couldn’t do in a given situation Alongwith these features came intuitive visual user interface designers with drag-and-drop functionality andassociated 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 interms 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 largedevelopment suite along with other “Visual” tools such as FoxPro and InterDev However, it was obvi-ous that each language still had a distinct environment in which to work, and as a result developmentsolutions 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 thevarious, 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 Microsoftdevelopment team mostly created on their own They had some input from external groups, but VisualStudio 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 thevarious 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 tohelp direct the shape of the programs, but only offer feedback about what was wrong, while Microsoftitself 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-namedWhidbey, would be the “user’s NET,” giving every developer using NET the ability to submit featurerequests and track issues as they progressed through the development cycle Microsoft also worked

Trang 40

lan-Figure I-1

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

Ngày đăng: 29/04/2014, 14:54

TỪ KHÓA LIÊN QUAN