About the Book
Find out how to fine-tune
Visual Studio .NET 2003 to take your programming skills to the next level.
Learn how to put all the built-in power
of Microsoft® Visual Studio® .NET 2003 to work with this comprehensive,
in-depth programming guide. It drills down into the internal workings of
Visual Studio .NET to help you get the most out of its features, editors,
and project-management capabilities. You’ll see how to extend this rich,
integrated development environment to maximize your productivity for any
project, no matter where you are in the development cycle—or which language
you use. You’ll also learn how to use macros and add-ins to simplify your
work. Code examples in every chapter show you exactly what to do. Topics
covered include:
Visual Studio .NET as a development tool:
• The evolution of Visual Studio .NET
• Project-management tools
• Editors and the IDE
• Macros
Extending Visual Studio .NET:
• The add-in architecture, the add-in
wizard, and the automation object model
• Add-in Manager Plus, which helps you
manage add-ins and associated registry entries
• Commands
• Managing solutions and projects programmatically
• Wizards
• Programming the user interface
• Text-editing objects and events
• The code model and Code Model Explorer,
which lets you browse your project’s code model view
Deployment, help, and advanced projects:
• Designing setup projects
• Visual Studio .NET 2003 Help
• Advanced projects
Related Books
Microsoft® ADO.NET (Core Reference)
Inside C#, Second Edition
Table of Contents
Acknowledgments
xv
Introduction
xvii
PART I VISUAL STUDIO
.NET AS A DEVELOPMENT TOOL
1 The Evolution of Visual
Studio .NET 3
Moving
to Visual Studio .NET 3
Developing
for .NET 4
Unmanaged
Development Enhancements 6
New Compiler Options 7
Updated Class Libraries 8
C++ Attributes 9
Standards Conformance 9
A New IDE 10
Visual
Studio .NET Features 10
Editors, Designers, and Tool Windows 11
Visual Studio .NET File Paths 21
Visual
Studio .NET Extensibility 24
Macros 24
Add-ins 25
Wizards 26
The Visual Studio Integration Program (VSIP) 26
2 Project Management in
Visual Studio .NET 29
Overview
of Solutions and Projects 29
Understanding
Solutions 31
Solution Items and Miscellaneous Files 32
Solution Properties 33
Solution and Solution User Options Files 35
Projects
39
Project Items 40
Project Properties 41
Project Source Files 50
Project Dependencies 56
Building
Projects and Solutions 57
3 The Visual Studio .NET
Editor 59
Documents
in the IDE 59
It's All About Text 60
Typing and Shortcuts 63
The Zen of Tabs and Code Formatting 70
Syntax
Coloring, Line Numbering, and Outlining (or, What the Compiler Saw)
73
Syntax Coloring 73
Line Numbering 77
Outlining 79
Programming
Help 81
IntelliSense 81
Dynamic Help 85
Using
the Command Window 86
Search,
Replace, and Regular Expressions 88
Wildcards 90
Regular Expressions 92
Searching from the Command Window 94
Incremental Searching 95
4 Visual Studio .NET Macros
97
Macros:
The Duct Tape of Visual Studio .NET 97
Recording Visual Studio .NET Macros 98
Macro Commands 100
Editing Macros in the Macros IDE 102
A Simple Macro 105
Working
with Macros 106
Manipulating Documents and Text 107
Moving Windows 109
Using Assemblies in Your Macros 112
Macro Events 113
Sharing
Macros with Others 116
Exporting Modules and Projects 116
Turning Macros into Add-ins 118
PART II EXTENDING VISUAL
STUDIO .NET
5 The Add-in Wizard and
the Automation Object Model 125
The Add-in
Wizard 125
Running the Add-in Wizard 126
The Add-in Project 127
Installing and Loading the Add-in 134
Debugging the Add-in 136
The Automation
Object Model 137
Automation Objects 138
Object Model Guidelines 139
Automation Events 140
6 Add-in Architecture
151
Writing
an Add-in from Scratch 151
Compiling the Basic Add-in 152
Registering the Basic Add-in with COM 153
Registering the Basic Add-in with Visual Studio .NET 156
Add-in
Events 158
The Add-in Event Sequence 158
The LifeCycle Add-in 160
The IDTExtensibility2
Interface 162
The EnvDTE Namespace 162
OnConnection 163
OnStartupComplete 165
OnAddInsUpdate 166
OnBeginShutdown 170
OnDisconnection 170
Add-in
Registry Named Values 171
CommandPreload and the PreloadAddinState Key 171
LoadBehavior and CommandLineSafe 174
SatelliteDLLPath and SatelliteDLLName 176
FriendlyName and Description 178
AboutBoxDetails and AboutBoxIcon 178
7 Commands
181
What
Is a Command? 181
Locating Commands 182
Command Names 183
Executing Commands 185
Creating Macro Commands 186
Creating
an Add-in Command 186
Handling a Command 188
Command State 189
How an Add-in Command Handler Is Found 191
The Command
User Interface 191
The Command Bar Object Model 192
The Primary Command Bar 193
Adding a New Command Bar User Interface 194
Using Custom Bitmaps 196
Restoring
a Lost Command and Its User Interface 197
devenv /setup 198
Custom Registration 198
Removing
a Command 202
Command
Parameters 205
Key Bindings
207
8 Managing Solutions
and Projects Programmatically 213
Working
with Solutions 213
Creating, Loading, and Unloading Solutions 214
Enumerating Projects 215
Capturing Solution Events 217
Solution Add-ins 223
Working
with Project Items 225
Enumerating Project Items 225
Adding and Removing Project Items 228
Working
with Language-Specific Project Objects 231
VSProject Projects 231
Leveraging
Visual Studio .NET Utility Project Types 238
Miscellaneous Files Project 238
Solution Items Project 240
Unmodeled Projects 240
Project
and Project Item Events 241
Managing
Build Configurations 243
Manipulating Solution Settings 243
Manipulating Project Settings 251
Build Events 254
Persisting
Solution and Project Information Across IDE Sessions 257
9 Visual Studio .NET
Wizards 259
An Overview
of Wizards 259
Types of Wizards 259
Creating
the Wizard Object 260
Creating
the .vsz File 264
Where to Save .vsz Files 265
Creating
Wizard Templates 268
Using Template Files 269
Solution Filenames and the New Project Wizard 271
Replacements 271
Raw Add New Item Templates 274
Custom
Wizards 275
Running a Custom Wizard Programmatically 276
Chaining Custom Wizards 277
The Wizard
Helper Library 279
Wizard Variables 283
Wizard Helper Methods 285
Completing the WizardBuilder Sample 285
10 Programming the
User Interface 287
Window
Basics 287
The Windows Collection 287
Using the Object Property 290
The Main Window 291
Explorer
Windows and the UIHierarchy Object 293
The UIHierarchy Object Tree 293
The UIHierarchy Object 295
The UIHierarchyItems Object 297
The UIHierarchyItem Object 297
The Toolbox
Window 298
Tabs and Items 298
Adding Items to the Toolbox 299
The Task
List Window 303
Task List Items 303
Adding New Tasks 303
The TaskItem Object 309
Task List Events 310
Comment Tokens 312
The Output
Window 316
Output Window Panes 316
The Forms
Designer Window 318
The IDesignerHost Interface 318
Marshaling 319
Adding Controls to a Form 319
Finding Existing Controls 320
A Form Layout Sample 321
Creating
Custom Tool Windows 322
Shim Controls 325
Setting the Tab Picture of a Custom Tool Window 329
Setting the Selection Object 329
The Options
Dialog Box 330
Changing Existing Settings 330
Creating Custom Settings 335
11 Text Editing Objects
and Events 341
Editor
Windows 341
The Window Object 342
The TextWindow and HTMLWindow Objects 343
The TextPane Object 345
Documents
348
The Document Object 348
The TextDocument Object 353
Point
Objects 353
TextPoint 353
VirtualPoint 354
EditPoint 357
The TextSelection Object 357
A Comparison of TextSelection and EditPoint 359
Undo
Contexts 360
Automatic Undo Contexts 361
Creating Undo Contexts 362
Stack Linkage 365
The LineChanged
Event 366
Multiple LineChanged Event Handlers 371
12 The Code Model
375
Discovering
Code 375
A Quick Tour Through a Source File 375
Getting a CodeElement from a Point Object 388
Generating
Code 389
Building a Source File 389
PART III DEPLOYMENT,
HELP, AND ADVANCED PROJECTS
13 Designing Setup
Projects 397
Microsoft
Windows Installer (MSI) Background 397
Creating
Custom Installation Projects 398
File System Editor 399
Registry Editor 404
File Types Editor 411
User Interface Editor 413
Custom Actions 421
Launch Conditions Editor 425
Merge
Modules 431
Setup
for .NET Programs 432
14 Visual Studio
.NET Help 441
Navigating
the Help System 441
Help Windows 443
Search and Index Options 444
Narrowing Search Results 445
Creating Custom Help Filters 446
Searching from the Command Window 447
Customizing
the Dynamic Help Window 448
Using the XML Help Provider Service 450
Creating
Custom Help Files 454
Registering Your Help Collection 460
15 Advanced Projects
in Visual Studio .NET 463
Visual
Studio .NET from the Command Line 463
Building Projects and Solutions from the Command Line 464
Setting GUI Options at the Command Line 468
VSIP Options 470
Source
Control with Visual SourceSafe 470
Setting Up VSS 470
Placing Files Under Source Control 471
Working with Files Under Source Control 474
Planning Your Solutions Carefully 479
Don't Break the Build 480
APPENDIX Code Model Reference
483
Code
Model Objects 483
FileCodeModel and CodeModel 483
CodeElement 488
Specialized Code Model Objects 491
Generating
Code 507
Common Parameters 507
Main Add Methods 509
Other Add Methods 513
Remove Methods 516
INDEX 519 |