You are previewing Microsoft® Visual Studio® 2010 Unleashed.
O'Reilly logo
Microsoft® Visual Studio® 2010 Unleashed

Book Description

This end-to-end deep dive into Microsoft Visual Studio 2010 Professional will help working developers squeeze maximum productivity out of Visual Studio 2010’s extraordinarily rich toolbox, whether they are writing code for the Web, Windows, Silverlight, or Microsoft’s Azure cloud computing environment.

The authors combine authoritative and detailed information about Microsoft’s latest IDE, with extensive insights and best practices drawn from decades of development experience. Developers will learn how to use Visual Studio 2010 Professional to take full advantage of the entire .NET platform, including Windows Presentation Foundation (WPF) for rich client development, Windows Communication Foundation (WCF) for building dynamic service-oriented solutions, and Windows Workflow Foundation (WF) for structured programming around business processes. The authors also present extensive new coverage of Microsoft’s powerful new tools for unit testing, application instrumentation, and code analysis.

By focusing entirely on Visual Studio 2010 Professional, the authors have gone deeper into Microsoft’s core product than ever before. Throughout, their focus is relentlessly practical: how to apply Microsoft’s tools to build better software, faster.

Detailed information on how to...

n Work with solutions, projects, browsers, explorers, editors, and designers

n Write better macros, add-ins, and wizards

n Save more time with Visual Studio 2010’s updated productivity tools

n Instrument, analyze, and test your software

n Refactor code for greater robustness, maintainability, and performance

n Share code with team members and the larger community

n Write powerful ASP.NET, ASP.NET MVC, and Silverlight web applications

n Implement robust service oriented architecture (SOA)–based applications

n Efficiently consume services with WCF

n Write advanced Windows applications with Windows Forms and WPF

n Construct data-centric applications with LINQ and Entity Framework

n Create and host workflow-based applications with WF

n Write applications for the Azure cloud

n Extend Visual Studio with the new Managed Extensibility Framework (MEF) and the Automation Object Model

n Build better object-oriented VB or C# software, and use new dynamic language features


Download all examples and source code presented in this book from

Table of Contents

  1. Title Page
  2. Copyright Page
  3. Dedications
    1. Dedications
  4. Contents at a Glance
    1. Contents at a Glance
  5. Table of Contents
    1. Table of Contents
  6. About the Authors
    1. About the Authors
  7. Acknowledgments
    1. Acknowledgments
  8. We Want to Hear from You!
    1. We Want to Hear from You!
  9. Introduction
    1. Introduction
    2. Who Should Read This Book?
    3. Focusing on Visual Studio Professional
    4. Downloadable Content
    5. How Is This Book Organized?
      1. Part I: An Introduction to Visual Studio 2010
      2. Part II: An In-Depth Look at the IDE
      3. Part III: Writing and Working with Code
      4. Part IV: Extending Visual Studio
      5. Part V: Creating Enterprise Applications
    6. Conventions Used in This Book
  10. Part I. An Introduction to Visual Studio 2010
    1. Chapter 1. A Quick Tour of Visual Studio 2010
      1. Chapter 1. A Quick Tour of Visual Studio 2010
      2. The Visual Studio Product Line
        1. Express Editions
        2. Professional Edition
        3. Premium
        4. Ultimate
        5. MSDN
        6. Related Tools
      3. Languages, Frameworks, and Application Templates
        1. Programming Language Choices
        2. The .NET Framework(s)
        3. The Many Faces of a .NET Application
      4. Developing Rich(er) Clients
        1. Windows (WinForms)
        2. Windows Presentation Foundation (WPF)
        3. Office-Based Solutions
      5. Creating Web Clients
        1. Building Websites with ASP.NET
        2. Adding Richer Features with AJAX
        3. Developing for Silverlight
      6. Making the Client Choice
      7. Coding for the Cloud
        1. Creating a Cloud Application
        2. Running a Cloud Application
        3. Publishing to the Cloud
      8. Working with Data
        1. Design Your Data
        2. Separate Data Design from Storage Schema
        3. Build Occasionally Connected Applications
      9. Write Connected, Service-Oriented Solutions
        1. Develop an Application/Business Process
        2. Create and Consume Services
      10. Summary
    2. Chapter 2. The Visual Studio IDE
      1. Chapter 2. The Visual Studio IDE
      2. Installing Visual Studio
        1. Choosing a Language
        2. Configuring Your Development Environment Settings
      3. Getting Started
        1. Startup Options
      4. Creating Your First Project
        1. Targeting Your Environment
      5. Navigating the IDE
        1. The Menus
        2. The Many Toolbars
        3. Customizing Toolbars
        4. The Solution Explorer
        5. The Text Editors
        6. The Visual Designers
        7. The Toolbox
        8. The Properties Window
      6. Managing the Many Windows of the IDE
        1. Pinning
        2. Docking
        3. Navigating IDE Windows
        4. Customize Your Font
      7. Summary
    3. Chapter 3. The .NET Languages
      1. Chapter 3. The .NET Languages
      2. Language Primer
        1. Programming Objects
        2. Types, Variables, and Constants
        3. Operators
        4. Making Decisions and Branching Code
        5. Looping
        6. Working with Groups of Items
        7. Programming with Attributes
        8. Creating and Raising Events
      3. Language Features
        1. Infer a Variable’s Data Type Based on Assignment
        2. Create an Object and Set Its Properties with a Single Line of Code
        3. Define a Collection and Initialize Its Values (New)
        4. Create an Instance of a Nonexistent Class
        5. Add Methods to Existing Classes
        6. Add Business Logic to Generated Code
        7. Access and Query Data Using the .NET Languages
        8. Write Simple, Unnamed Functions Within Your Code
        9. Split an Assembly Across Multiple Files
        10. Work with XML Directly Within Your Code (VB Only)
        11. Remove Unused Arguments from Event Handlers (VB Only)
        12. Create an Automatically Implemented Property (New for VB)
        13. Drop the Underscore in VB for Line Continuation (New)
        14. Work with Dynamic Languages/Objects (New)
        15. Covariance and Contravariance (New)
      4. The .NET Framework
        1. A Map to the .NET Framework
      5. Summary
  11. Part II. An In-Depth Look at the IDE
    1. Chapter 4. Solutions and Projects
      1. Chapter 4. Solutions and Projects
      2. Understanding Solutions
        1. Creating a Solution
        2. Working with Solutions
      3. Getting Comfortable with Projects
        1. Creating a Project
        2. Working with Project Definition Files
        3. Working with Projects
      4. Summary
    2. Chapter 5. Browsers and Explorers
      1. Chapter 5. Browsers and Explorers
      2. Solution Explorer
        1. Visual Cues and Icons
        2. Managing Solutions
        3. Managing Projects
      3. Class View
        1. Toolbar
        2. Search Bar
        3. Objects Pane
        4. Members Pane
      4. Server Explorer
        1. Data Connections
        2. Server Components
      5. Object Browser
        1. Changing the Scope
        2. Browsing Objects
      6. Document Outline
        1. Editing Elements
      7. Summary
    3. Chapter 6. Introducing the Editors and Designers
      1. Chapter 6. Introducing the Editors and Designers
      2. The Basics
        1. The Text Editor
        2. Visual Studio Designers
      3. Coding with the Code Editor
        1. Opening an Editor
        2. Writing Code in the Code Editor
        3. Anatomy of the Code Editor Window
        4. Code Navigation Tools
        5. Searching Documents
        6. Debugging in the Text Editor
        7. Printing Code
        8. Using the Code Definition Window
      4. Creating and Editing XML Documents and Schema
        1. Inferring Schema
        2. Designing XML Schemas
        3. Editing XSLT Style Sheets
      5. Working with Cascading Style Sheets
        1. Adding Style Rules
        2. Defining Style Sheet Attributes
      6. Developing Windows Client Applications
        1. Creating a Windows Forms Project
        2. Creating a Windows Presentation Foundation Project
      7. Developing Web Forms
        1. Designing a Web Form Application
      8. Authoring WinForms Components and Controls
        1. Creating a New Component or Control
        2. Further Notes on Writing Component Code
      9. Creating Classes with the Class Designer
        1. Creating a Class Diagram
        2. Adding Items to the Diagram
        3. Defining Relationships Between Classes
        4. Defining Methods, Properties, Fields, and Events
      10. Summary
    4. Chapter 7. The .NET Community: Interacting Online
      1. Chapter 7. The .NET Community: Interacting Online
      2. The Community Features of Visual Studio
        1. The Visual Studio Start Page
      3. Accessing Help
        1. Manage Your Help Settings
        2. Using the Visual Studio Documentation
        3. MSDN Forums
        4. Reporting a Bug and Other Customer Feedback Options
        5. Samples
      4. Discovering and Consuming Shared Content
        1. Examining Shared Content Types
        2. Finding the Right Content
        3. Installing and Storing Shared Content
      5. Participating in the Community
        1. Starter Kits Versus Templates
        2. Creating a Project Template
        3. Creating Item Templates
        4. Packaging Your Creation for Wider Distribution
      6. Summary
  12. Part III. Writing and Working with Code
    1. Chapter 8. Working with Visual Studio’s Productivity Aids
      1. Chapter 8. Working with Visual Studio’s Productivity Aids
      2. Basic Aids in the Text Editor
        1. Change Tracking
        2. Coding Problem Indicators
        3. Active Hyperlinking
        4. Syntax Coloring
      3. Outlining and Navigation
        1. Code Outlining
        2. Tag Navigation
      4. Smart Tags and Smart Tasks
        1. HTML Designer
        2. Windows Forms Designer
        3. Code Editor
      5. IntelliSense
        1. Complete Word
        2. Quick Info
        3. List Members
        4. Parameter Info
        5. Organize Usings
        6. Code Snippets and Template Code
        7. Brace Matching
        8. Customizing IntelliSense
      6. The Task List
        1. Comment Tasks
        2. Shortcut Tasks
        3. User Tasks
      7. Summary
    2. Chapter 9. Testing Code
      1. Chapter 9. Testing Code
      2. Unit Testing Basics
        1. Creating a Test Project
        2. Generating Tests from Existing Code
        3. Writing an Actual Unit Test
        4. Running Your Tests
        5. Viewing Test Results
        6. Configuring Testing Options and Settings
      3. The Unit Testing Framework
        1. The TestContext Class
        2. The Test Attribute Classes
        3. Unit Test Setup and Tear Down
        4. The Assert Classes
        5. Testing Your Exceptions
        6. Creating Data-Bound Unit Tests
      4. Writing ASP.NET Hosted Unit Tests
        1. Defining ASP.NET Attributes
        2. Generating an ASP.NET Unit Test
        3. Configuring Your Test Project Host
      5. Configuring Unit Test Attributes
        1. Defining a Connection with the Properties Dialog Box
      6. Creating Ordered Tests
      7. Organizing Your Tests
        1. The Test View Window
        2. The Test List Editor
      8. Summary
    3. Chapter 10. Refactoring Code
      1. Chapter 10. Refactoring Code
      2. Visual Studio Refactoring Basics
        1. Invoking the Refactoring Tools
        2. Previewing Changes
      3. Renaming Code
        1. Accessing the Rename Operation
        2. Working with the Rename Dialog Box
      4. Extract Method
        1. Accessing the Extract Method Refactor
        2. Extracting Methods
        3. Generate Method Stub
      5. Extract Interface
        1. Accessing the Extract Interface Refactor
        2. Extracting Interfaces
      6. Refactor Parameters
        1. Remove Parameters
        2. Reorder Parameters
      7. Encapsulate Field
        1. Accessing Encapsulate Field
        2. The Encapsulate Field Dialog Box
      8. Summary
    4. Chapter 11. Debugging Code
      1. Chapter 11. Debugging Code
      2. Debugging Basics
        1. The Scenario
        2. The Many Phases of Debugging
        3. Debugging the Application (Self-Checking)
        4. Debugging Basics Summary
      3. The Visual Studio Debugger
        1. The Debug Menu and Toolbar
        2. Debug Options
        3. Stepping In, Out, and Over Code
        4. Indicating When to Break into Code
        5. Working with Tracepoints (When Hit Option)
        6. Viewing Data in the Debugger
        7. Using the Edit and Continue Feature
      4. Advanced Debugging Scenarios
        1. Remote Debugging
        2. Debugging WCF Services
        3. Debugging Multithreaded Applications
        4. Debugging Parallel Applications
        5. Debugging a Client-Side Script
        6. Debugging Crash Information (Dump Files)
      5. Summary
    5. Chapter 12. Deploying Code
      1. Chapter 12. Deploying Code
      2. An Overview of Client Deployment Options
        1. Introducing ClickOnce Deployments
        2. Introducing Windows Installer-Based Deployments
      3. Publishing a Project with ClickOnce
      4. Publishing a Project with the Windows Installer
        1. The File System Editor
        2. The Registry Editor
        3. The File Types Editor
        4. The User Interface Editor
        5. The Custom Actions Editor
        6. The Launch Conditions Editor
      5. Publishing an ASP.NET Website or Application
        1. Using the Web Deployment Tool
        2. Using the Copy Web Site Tool
      6. Summary
  13. Part IV. Extending Visual Studio
    1. Chapter 13. Introducing the Automation Object Model
      1. Chapter 13. Introducing the Automation Object Model
      2. An Overview of the Automation Object Model
        1. Object Model Versions
        2. Automation Categories
        3. The DTE/DTE2 Root Object
      3. Solution and Project Objects
        1. Controlling Projects in a Solution
        2. Accessing Code Within a Project
      4. Windows
        1. Referencing Windows
        2. Interacting with Windows
        3. Text Windows and Window Panes
        4. The Tool Window Types
        5. Linked Windows
      5. Command Bars
      6. Documents
        1. Text Documents
      7. Command Objects
        1. Executing a Command
        2. Mapping Key Bindings
      8. Debugger Objects
      9. Automation Events
      10. Summary
    2. Chapter 14. Writing Macros
      1. Chapter 14. Writing Macros
      2. Recording a Macro
      3. Using the Macro Explorer
      4. Writing Macros with the Macro IDE
        1. Working with Macro Projects
        2. Writing a Macro
        3. Debugging
        4. Handling Events
        5. Invoking Macros
      5. Summary
    3. Chapter 15. Writing Add-ins and Wizards
      1. Chapter 15. Writing Add-ins and Wizards
      2. Creating Your First Add-in Project
        1. Setting Add-in Parameters
      3. The Structure of an Add-in
        1. The Life Cycle of an Add-in
        2. Reacting to Commands
        3. Managing Add-ins
      4. A Sample Add-in: Color Palette
        1. Getting Started
        2. Creating the User Control
        3. Finishing the Connect Class
        4. Exposing Add-in Settings
      5. Creating a Visual Studio Wizard
        1. Examining the Wizard Structure
        2. Creating an Add New Item Wizard
      6. Summary
    4. Chapter 16. Extending the Code Editor Using MEF
      1. Chapter 16. Extending the Code Editor Using MEF
      2. The Extensibility Problem
        1. Creating Dynamic Applications
      3. MEF Architecture
        1. MEF Principles
        2. Working with MEF
      4. The Visual Studio Editor and MEF
        1. Editor Extension Points
        2. Using the Visual Studio SDK
        3. Using the Extension Manager
      5. Creating Your Own MEF-Based Editor Extension
      6. Summary
  14. Part V. Creating Enterprise Applications
    1. Chapter 17. Creating ASP.NET Applications
      1. Chapter 17. Creating ASP.NET Applications
      2. The Basics of an ASP.NET Website
        1. Creating a New Website or Web Application
        2. Controlling Project Properties and Options
        3. Creating Web Pages
      3. Designing Your User Interface
        1. Determining Page Layout and Control Positioning
        2. Creating a Common Look and Feel
        3. Creating a User-Configurable UI
      4. Working with the ASP.NET Controls
        1. An Overview of the ASP.NET Controls
        2. The ASP.NET Standard Controls
        3. Validation Controls
        4. The Login Controls
        5. Site Navigation Controls
        6. Data Controls
        7. User Controls
      5. Creating an ASP.NET MVC Application
        1. Understanding ASP.NET MVC
        2. Creating an MVC Project
        3. Creating Functionality Using ASP.NET MVC
      6. Summary
    2. Chapter 18. Building Windows Forms Applications
      1. Chapter 18. Building Windows Forms Applications
      2. The Basics of Form Design
        1. Considering the End User
        2. Understanding the Role of UI Standards
        3. Planning the User Interface
      3. Creating a Form
        1. The Windows Forms Application Project Type
        2. Form Properties and Events
      4. Adding Controls and Components
        1. Control Layout and Positioning
        2. Using Containers
        3. Control Appearance and Behavior
        4. Working with ToolStrip Controls
        5. Displaying Data
      5. Creating Your Own Controls
        1. Subclassing an Existing Control
        2. Designing a User Control
        3. Creating a Custom Control
      6. Summary
    3. Chapter 19. Creating Richer, Smarter User Interfaces
      1. Chapter 19. Creating Richer, Smarter User Interfaces
      2. The Windows Presentation Foundation Platform
        1. Programming Model
      3. Introducing the WPF Designer
        1. XAML and Design Panes
      4. Programming with WPF
        1. Layout
        2. Styles and Templates
        3. Data Binding
        4. Routed Events
      5. Building a Simple Image Viewer Application
        1. Starting the Layout
        2. Storing the Images
        3. Binding to the Images
        4. Button Event Handlers and Image Effects
        5. Path Selection with a Common Dialog Box
      6. Summary
    4. Chapter 20. Creating Rich Browser Applications
      1. Chapter 20. Creating Rich Browser Applications
      2. Building Rich, Cross-Browser Interfaces with ASP.NET Ajax
        1. The ASP.NET Ajax Controls
        2. Creating a Page that Supports Partial Update
        3. The ASP.NET Ajax Library/Control Toolkit
      3. Creating Unique, Rich Experiences on Windows via the Browser
        1. Choosing Between WPF Standalone and WPF XBAP
        2. Creating a WPF Browser Application
        3. Security Considerations
        4. Deploying a WPF Browser Application
      4. Delivering Interactive Experiences Across Platforms
        1. Getting Started with Silverlight
        2. Creating a Silverlight Application
        3. Silverlight 4.0
      5. Summary
    5. Chapter 21. Working with Databases
      1. Chapter 21. Working with Databases
      2. Creating Tables and Relationships
        1. Creating a New SQL Server Database
        2. Defining Tables
        3. Using the Database Diagram Designer
      3. Working with SQL Statements
        1. Writing a Query
        2. Creating Views
        3. Developing Stored Procedures
        4. Creating Triggers
        5. Creating User-Defined Functions
      4. Using Database Projects
        1. Creating a Database Project
        2. The Schema View
        3. Building and Deploying
        4. A Note on Data Tier Applications
      5. Creating Database Objects in Managed Code
        1. Starting a SQL CLR Project
        2. Creating a Stored Procedure in C#
      6. Binding Controls to Data
        1. An Introduction to Data Binding
        2. Auto-Generating Bound Windows Forms Controls
        3. Editing Typed DataSets
        4. Manually Binding Windows Forms Controls
        5. Data Binding in WPF Applications
        6. Data Binding with Web Controls
      7. Object Relational Mapping
        1. An Overview of LINQ
        2. Mapping Using the O/R Designer
        3. LINQ Code
        4. Working with the Entity Framework
        5. Querying Against the Entity Data Model
      8. Summary
    6. Chapter 22. Service-Oriented Applications
      1. Chapter 22. Service-Oriented Applications
      2. Service Fundamentals
        1. Why ASP.NET Web Services and WCF
      3. ASP.NET Web Service Applications
        1. The ASP.NET Web Service Project Template
        2. Coding an ASP.NET Web Service
        3. Consuming an ASP.NET Web Service
        4. ASP.NET Web Service Exceptions
      4. WCF Service Applications
        1. The WCF Project Template
        2. Creating a WCF Service
        3. Configuring a WCF Service
        4. Consuming a WCF Service
        5. Hosting and Deploying a WCF Service
      5. Summary
    7. Chapter 23. Embedding Workflow in Your Applications
      1. Chapter 23. Embedding Workflow in Your Applications
      2. Windows Workflow Fundamentals
        1. The Components of a Workflow
        2. The Workflow Project Templates
        3. The Workflow Designer
        4. The Workflow Item Templates
        5. The Basics of Creating a Workflow
      3. Working with the Built-In Workflow Activities
        1. Controlling Flow
        2. Runtime and Primitives
        3. Error Handling
        4. Collection Activities
        5. Supporting Transactions
        6. Managing Messages
        7. Creating Flowchart Workflows
      4. Creating a Workflow Application
        1. The Scenario: Travel Request
        2. The Application Project Templates
        3. Create the Database and Data Access Library
        4. Create the Vendor Reservation Service
        5. Create the Custom Activity Library
        6. Design the Workflow (Travel Request)
        7. Creating the Client Application (Request and Approval Forms)
        8. Running the Travel Request Workflow Application
      5. Summary
    8. Chapter 24. Developing Office Business Applications
      1. Chapter 24. Developing Office Business Applications
      2. An Overview of Office Extension Features
        1. Office Features
        2. Visual Studio Office Project Types
      3. Creating an Office Add-in
        1. Customizing the Ribbon
        2. Customizing the Task Pane
        3. Creating Outlook Form Regions
      4. Creating an Office Document Extension
        1. Hosting Controls
        2. Creating an Actions Pane
        3. Storing Data in the Data Cache
        4. Implementing Your Own Smart Tags
      5. Summary
    9. Chapter 25. Developing Applications in the Cloud with Windows Azure
      1. Chapter 25. Developing Applications in the Cloud with Windows Azure
      2. Azure Fundamentals
        1. Azure Platform Benefits
        2. Setting Up Your Development Environment
        3. Azure Roles
        4. The Azure Project Templates
        5. Azure Storage Options
        6. Hello Cloud
      3. Building and Deploying an Azure Application
        1. The Scenario
        2. Developing the Application
        3. Subscribing to the Azure Services (Get an Account)
        4. Creating a Storage Account
        5. Creating a Hosted Service Account
        6. Preparing Your Application for Publishing
        7. Publish and Deploy Your Application to the Cloud
        8. Promoting to Production
        9. Next Steps
      4. Summary
  15. Index