You are previewing Microsoft Visual Studio 2015 Unleashed, Third Edition.
O'Reilly logo
Microsoft Visual Studio 2015 Unleashed, Third Edition

Book Description

Microsoft Visual Studio 2015 empowers you to write next-generation applications for any modern environment: mobile, web, cloud, universal Windows 10/8.x, database, and beyond. This end-to-end deep dive will help working developers squeeze maximum productivity out of Microsoft’s powerful new toolset.

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 quickly get comfortable with Visual Studio 2015’s updated interface, master its new capabilities, leverage its extensive new support for open standards, and discover multiple opportunities to leverage its .NET 4.6 platform and language improvements.

By focusing entirely on Visual Studio 2015 Professional, the authors go deeper into Microsoft’s core product than ever before. You’ll find expert coverage of everything from debugging through deploying to Azure, IDE extension and automation through cross-platform mobile development. Throughout, this book’s focus is relentlessly practical: how to apply Microsoft’s tools to build better software, faster.

Detailed information on how to...

  • Master Visual Studio 2015’s updated interface and key tools: Solutions, Projects, Browsers, Explorers, Editors, and Designers to improve productivity

  • Develop robust cross-platform mobile apps for Windows, iOS, and Android using Apache Cordova templates for Visual Studio

  • Use the new ASP.NET 5 to build modern web solutions that run on Windows, Mac, or Linux

  • Develop Single Page Applications (SPAs) based on HTML5 and rich client-side JavaScript frameworks such as Knockout, AngularJS, Bootstrap, and more

  • Accelerate cloud development with the Azure SDK, QuickStart templates, and Azure management portal

  • Create mobile service solutions using ASP.NET Web API and WCF

  • Streamline data development across multiple platforms with Entity Framework 7

  • Develop modern Microsoft Office business applications

  • Perform robust, automated unit testing as you code, increasing your confidence in changes and refactoring

  • Extend the VS 2015 IDE and Code Editor by creating custom, productivity-enhancing solutions

  • Download all examples and source code presented in this book from as they become available.

    Table of Contents

    1. About This eBook
    2. Title Page
    3. Copyright Page
    4. Contents at a Glance
    5. Table of Contents
    6. About the Authors
    7. Dedication
    8. Acknowledgments
    9. We Want to Hear from You!
    10. Reader Services
    11. Introduction
      1. Who Should Read This Book?
      2. How Is This Book Organized?
        1. Part I: Introducing Visual Studio 2015
        2. Part II: An In-Depth Look at the IDE
        3. Part III: Working with the Visual Studio Tools
        4. Part IV: Extending Visual Studio
        5. Part V: Building Web Applications
        6. Part VI: Building Windows Client Apps
        7. Part VII: Creating Mobile Apps
      3. Conventions Used in This Book
      4. Source Code
    12. Part I: Introducing Visual Studio 2015
      1. Chapter 1. A Quick Tour of Visual Studio 2015
        1. The Visual Studio Product Line
          1. Community Edition
          2. Professional Edition
          3. Enterprise
          4. MSDN
          5. TFS and Related Tools
        2. Languages and Frameworks
          1. Programming Language Choices
          2. The .NET Framework
        3. The Many Faces of a .NET Application
          1. Windows
          2. Web
          3. Mobile
        4. Developing Windows 8/10 Clients
          1. Windows (WinForms)
          2. Windows Presentation Foundation (WPF)
          3. Office/SharePoint Solutions
        5. Creating Web Applications with ASP.NET 5
          1. Building Websites with Web Forms
          2. Developing with MVC/Razor
          3. Creating a Single Page Application (SPA)
          4. Coding Web Services with Web API
        6. Coding for Azure
          1. Creating a Cloud Application
          2. Publishing to Azure
        7. Working with Data
          1. Model as Code (Code First)
        8. Writing Mobile Apps
          1. Create an Apache Cordova App
        9. Summary
      2. Chapter 2. The Visual Studio IDE
        1. Installing Visual Studio
          1. Installing Optional Features
          2. Signing In to Visual Studio
        2. Managing Your IDE Settings
          1. Specify Stored and Synchronized Settings
          2. Change Color Theme
          3. Manually Import/Export and Change Default IDE Settings
          4. Switch IDE User
        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. Custom Window Layouts
          4. Navigating IDE Windows
          5. Touch Support
          6. Customize Your IDE Font
        7. Providing Feedback on Visual Studio
          1. The Customer Experience Program
        8. Summary
      3. Chapter 3. The .NET Languages
        1. What’s New in C# 6.0 and VB 14
          1. Null-Conditional Operators
          2. ReadOnly Auto Properties
          3. NameOf Expression
          4. Using (Imports) Statics
          5. String Interpolation
          6. Lambda Expressions as Methods (C# Only)
          7. Index Initializers (C# Only)
        2. Language Primer
          1. Programming Objects
          2. Types, Variables, and Constants
          3. Understanding 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 Initialize Its Values (Object Initializers)
          3. Define a Collection and Initialize Its Values
          4. Creating an Instance of a Nonexistent Class
          5. Add Methods to Existing Classes (Extension Methods)
          6. Add Business Logic to Generated Code (Partial Methods)
          7. Access and Query Data Using the .NET Languages
          8. Write Simple Unnamed Functions Within Your Code (Lambda Expressions)
          9. Splitting an Assembly Across Multiple Files
          10. Working with XML Directly Within Your Code (VB Only)
          11. Removing Unused Arguments from Event Handlers (VB Only)
          12. Creating an Automatically Implemented Property
          13. Dropping the Underscore in VB for Line Continuation
          14. Working with Dynamic Languages/Objects
          15. Covariance and Contravariance
        4. Asynchronous Programming
        5. The .NET Framework
          1. A Map to the .NET Framework
        6. Summary
    13. Part II: An In-Depth Look at the IDE
      1. Chapter 4. Solutions and Projects
        1. Understanding Solutions
          1. Creating a Solution
          2. Working with Solutions
        2. Getting Comfortable with Projects
          1. Creating a Project
          2. Working with Project Definition Files
          3. Working with Projects
        3. Summary
      2. Chapter 5. Browsers and Explorers
        1. Leveraging the Solution Explorer
          1. Visual Cues and Item Types
          2. Interacting with Items
          3. Inspecting Objects
        2. Class View
          1. Toolbar
          2. Search Bar
          3. Objects Pane
          4. Members Pane
        3. Server Explorer
          1. Data Connections
          2. Server Components
          3. Azure
        4. Object Browser
          1. Changing the Scope
          2. Browsing Objects
        5. Document Outline
          1. Editing Elements
        6. Summary
      3. Chapter 6. Introducing the Editors and Designers
        1. Getting Started with the Basics
          1. The Text Editor
          2. Visual Studio Designers
        2. 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
        3. Creating and Editing XML Documents and Schema
          1. Inferring Schema
          2. Designing XML Schemas
          3. Editing XSLT Style Sheets
        4. Working with Cascading Style Sheets
          1. Adding Style Rules
          2. Defining Style Sheet Attributes
        5. Developing Windows Client Applications
          1. Creating a Windows Forms Project
          2. Creating a Windows Presentation Foundation Project
        6. Developing Web Forms
          1. Designing a Web Form Application
        7. Authoring WinForms Components and Controls
          1. Creating a New Component or Control
          2. Further Notes on Writing Component Code
        8. 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
        9. Summary
    14. Part III: Working with the Visual Studio Tools
      1. Chapter 7. Working with Visual Studio’s Productivity Aids
        1. Basic Aids in the Text Editor
          1. Change Tracking
          2. Coding Problem Indicators
          3. Active Hyperlinking
          4. Syntax Coloring
        2. Outlining and Navigation
          1. Code Outlining
          2. Tag Navigation
        3. Smart Tasks and Light Bulbs
          1. HTML Designer
          2. Windows Forms Designer
          3. Code Editor
        4. 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
        5. The Task List
          1. Shortcut Tasks
          2. Comment Tasks
        6. Summary
      2. Chapter 8. Testing Code
        1. Unit Testing Basics
          1. Creating a Test Project
          2. Writing a Unit Test
          3. Running Your Tests
          4. Controlling Test Settings
        2. The Unit Testing Framework
          1. The TestContext Class
          2. The Test Attribute Classes
          3. Unit Test Setup and Teardown
          4. The Assert Classes
          5. Testing Your Exceptions
          6. Creating Data-Driven Unit Tests
        3. Testing Web Applications
          1. Unit Testing MVC and Web API Projects
          2. Unit Testing ASP.NET Pages
        4. Creating Ordered Tests
        5. Summary
      3. Chapter 9. Refactoring Code
        1. Visual Studio Refactoring Basics
          1. Invoking the Refactoring Tools
          2. Making (and Previewing) Changes
          3. Using the Class Designer to Refactor
        2. Renaming Code
          1. Accessing the Rename Operation
          2. Working with the Rename Dialog Box
        3. Refactoring Variable Assignments
          1. Introduce Constant
          2. Introduce Local
          3. Inline Temporary Variable
        4. Extract Method
          1. Accessing the Extract Method Refactor
          2. Extracting Methods
          3. Extracting a Single Line of Code
          4. Generate Method Stub
        5. Extract Interface
          1. Accessing the Extract Interface Refactor
          2. Extracting Interfaces
        6. Change Signature
          1. Removing a Parameter
          2. Reorder Parameters
        7. Encapsulate Field
          1. Accessing Encapsulate Field
        8. Summary
      4. Chapter 10. Debugging Code
        1. Debugging Basics
          1. The Scenario
          2. The Many Phases of Debugging
          3. Debugging the Application (Self-Checking)
          4. Debugging Basics Summary
        2. 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
        3. 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)
          7. Debugging Windows Store Apps
        4. Summary
      5. Chapter 11. Deploying Code
        1. An Overview of Client Deployment Options
          1. Introducing ClickOnce Deployments
          2. Introducing Windows Installer and InstallShield Deployments
        2. Publishing a Project with ClickOnce
        3. Publishing a Project with InstallShield Limited Edition
        4. Publishing an ASP.NET Web Application
          1. Selecting a Target
          2. Configuring a Connection
          3. Configuring Deployment Settings
          4. Previewing the Publication
        5. Summary
      6. Chapter 12. Developing Applications in the Cloud with Windows Azure
        1. Create Your Azure Account
          1. Azure Account Sign-Up
          2. Link Your Account to Visual Studio
          3. Manage Azure Subscriptions
        2. Create and Deploy an Azure Web Apps in Visual Studio
          1. The Azure Hosting Platform
          2. Create the ASP.NET Application and Azure Hosting
          3. Deploy/Publish an Application to Azure
          4. Set Up an Existing Application to Publish to an Azure web app
          5. Website Management with Azure Server Explorer
          6. Debug an Azure web app
        3. Create Your Web App from the Azure Portal
          1. Create the Application Hosting Environment
          2. Configuring Your New Azure web app
          3. The Website Toolbar
          4. Creating a Database
          5. Deploying to the New Environment from Visual Studio
        4. Monitor and Manage Applications in Azure
          1. Monitor and Manage a Website
          2. Monitor and Manage a SQL Database
        5. The Azure SDK for Visual Studio 2015
          1. Download, Install, and Sign In
          2. QuickStart Templates
          3. Azure Resource Group Deployment Projects
        6. Azure Cloud Services (PaaS)
          1. Creating a Cloud Service Project
          2. Running Your Cloud Service Project Locally
          3. Deploy the Cloud Service Project
        7. Summary
      7. Chapter 13. Working with Databases
        1. Creating Tables and Relationships
          1. Creating a New SQL Server Database
          2. Defining Tables
        2. Working with SQL Statements
          1. Writing a Query
          2. Creating Views
          3. Developing Stored Procedures
          4. Creating Triggers
          5. Creating User-Defined Functions
        3. Using Database Projects
          1. Creating a Database Project
          2. Changing the Database
          3. Building and Deploying
        4. Creating Database Objects in Managed Code
          1. Creating a Stored Procedure in C#
        5. Binding Controls to Data
          1. An Introduction to Data Binding
          2. Autogenerating Bound Windows Forms Controls
          3. Editing Typed Data Sets
          4. Manually Binding Windows Forms Controls
          5. Data Binding in WPF Applications
          6. Data Binding with Web Controls
        6. 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
        7. Summary
    15. Part IV: Extending Visual Studio
      1. Chapter 14. Introducing the Automation Object Model
        1. An Overview of the Automation Object Model
          1. Object Model Versions
          2. Automation Categories
          3. The DTE/DTE2 Root Object
        2. Solution and Project Objects
          1. Controlling Projects in a Solution
          2. Accessing Code Within a Project
        3. Working with Windows
          1. Referencing Windows
          2. Interacting with Windows
          3. Text Windows and Window Panes
          4. The Tool Window Types
          5. Linked Windows
        4. Command Bars
        5. Documents
          1. Text Documents
        6. Command Objects
          1. Executing a Command
          2. Mapping Key Bindings
        7. Debugger Objects
        8. Summary
      2. Chapter 15. Extending the IDE
        1. Creating Your First Extension
          1. Setting Package Parameters
          2. Adding Project Items
        2. The Structure of an Extension
          1. Defining and Reacting to Commands
        3. A Sample Extension: Color Selector
          1. Getting Started
          2. Creating the User Control
          3. Finishing the Package
        4. Summary
      3. Chapter 16. Extending the Code Editor
        1. The Extensibility Problem
          1. Creating Dynamic Applications
        2. MEF Architecture
          1. MEF Principles
          2. Working with MEF
        3. The Visual Studio Editor and MEF
          1. Editor Extension Points
          2. Using the Visual Studio SDK
          3. Managing Extensions and Updates
        4. Creating Your Own MEF-Based Editor Extension
        5. Summary
    16. Part V: Building Web Applications
      1. Chapter 17. Building Modern Websites with ASP.NET 5
        1. ASP.NET Website Fundamentals
        2. Introducing ASP.NET 5
          1. The .NET Core Framework and Execution Environment
          2. Choosing an ASP.NET Project Template
          3. Understanding the ASP.NET 5 Project Template and Related Files
          4. ASP.NET 5 Dependencies and Package Managers
        3. Creating a Web Application with ASP.NET 5/MVC 6
          1. Understanding the MVC Pattern
          2. Creating a New ASP.NET 5 MVC 6 Project
        4. Writing ASP.NET Server Code (Models and Controllers)
          1. Defining a Model (Using Entity Framework 7)
          2. Developing Controllers
        5. Coding for the UI (Views and Related Web UI Elements)
          1. The HTML Tags
          2. The Razor Syntax
          3. HTML Helpers
          4. Page Layout with Razor
          5. Strongly Typed Views
          6. User Input Validation
          7. Creating the Customer Example Pages
          8. View Components, View Models, and Partial Views
          9. Using Scaffolding to Generate a Controller and Views
        6. Summary
      2. Chapter 18. Using JavaScript and Client-Side Frameworks
        1. JavaScript Fundamentals
          1. Storing and Using Scripts
          2. Writing JavaScript
          3. Functions
          4. Objects
          5. Built-In Objects
          6. Working with the Browser Object Model (BOM)
          7. Document Object Model (DOM)
          8. Events
        2. Developing with jQuery
          1. jQuery in Your Visual Studio Project
          2. Selecting Elements
          3. Acting on Your Selection
          4. Traversing Your Selections
          5. Accessing Selection Content
          6. Changing Elements/Attributes
          7. Handling Events
          8. Animations and Effects
          9. jQuery and AJAX
        3. Building Single-Page Applications (SPAs) with Client-Side JavaScript Frameworks
          1. Selecting a Client Framework
          2. Responsive Web Layout with Bootstrap 3
          3. Minify Your JavaScript with Gulp
          4. Using Knockout
          5. Creating a Site with AngularJS
        4. Summary
      3. Chapter 19. Building and Consuming Services with Web API and WCF
        1. Service Fundamentals
          1. Why ASP.NET Web API and WCF
          2. Key Web Service Terms
        2. Use ASP.NET Web API to Build HTTP Services
          1. Creating an ASP.NET Web API Project
          2. Defining a Model
          3. Creating the Services (Controller)
          4. Understanding Service Routing
          5. Consuming an ASP.NET Web API Service
        3. WCF Service Applications
          1. The WCF Project Template
          2. Creating a WCF Service
          3. Running and Testing Your WCF Service
          4. Consuming a WCF Service
          5. Creating/Calling REST-Based WCF Services
          6. Hosting and Deploying a WCF Service
        4. Summary
    17. Part VI: Building Windows Client Apps
      1. Chapter 20. Building Windows Forms Applications
        1. The Basics of Form Design
          1. Considering the End User
          2. Understanding the Role of UI Standards
          3. Planning the User Interface
        2. Creating a Form
          1. The Windows Forms Application Project Type
          2. Form Properties and Events
        3. 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
        4. Creating Your Own Controls
          1. Subclassing an Existing Control
          2. Designing a User Control
          3. Creating a Custom Control
        5. Summary
      2. Chapter 21. Building WPF Applications
        1. The Windows Presentation Foundation Platform
          1. Programming Model
        2. Introducing the WPF Designer
          1. XAML and Design Panes
        3. Programming with WPF
          1. Layout
          2. Styles and Templates
          3. Data Binding
          4. Routed Events
        4. 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
        5. Summary
      3. Chapter 22. Developing Office Business Applications
        1. An Overview of Office Extension Features
          1. Office Features
          2. Visual Studio Office Project Types
        2. Creating an Office Add-In
          1. Customizing the Ribbon
          2. Customizing the Task Pane
          3. Creating Outlook Form Regions
        3. Creating an Office Document Extension
          1. Hosting Controls
          2. Creating an Actions Pane
          3. Storing Data in the Data Cache
        4. Extending Office with Webpages
          1. Starting with the App for Office Project Template
        5. Summary
    18. Part VII: Creating Mobile Apps
      1. Chapter 23. Developing Windows Store Applications
        1. Introducing the Modern UI
          1. Modern UI Attributes
        2. The Windows Runtime Library
          1. Language Choices
          2. The Application Model
        3. Building a Windows Store Application
          1. Selecting the Project Type
          2. Designing the Layout
          3. Reacting to Lifecycle Events
          4. Publishing to the Windows Store
        4. Summary
      2. Chapter 24. Creating Windows Phone Applications
        1. Windows Phone Fundamentals
          1. The UI Basics
          2. The Programming Model
        2. Moving from Silverlight to WinRT
          1. Porting a Simple Silverlight Phone App to WinRT
        3. Building a Universal App
          1. The Universal Project Types
          2. Creating the Data Model and View Model
          3. Creating the Windows Phone UI
          4. Creating the Windows UI
        4. Summary
      3. Chapter 25. Writing Cross-Platform Mobile Applications with Apache Cordova
        1. Fundamentals of Cordova Development
          1. How Cordova Works
          2. Cordova Dependencies
          3. The Cordova Project Template
          4. Creating a Basic Cordova App
          5. Running and Debugging Your App
        2. Using Cordova Frameworks and Plug-Ins
          1. Choosing Cordova Client Frameworks
          2. Cordova Plug-Ins (for Accessing Native Device Capabilities)
        3. Developing a Cordova App with Ionic and Angular
          1. Set Up Your Project
          2. Anatomy of the Ionic-Angular-Cordova App
          3. Rebuild the Sample App
          4. Support Storage
          5. Running on Windows Phone
          6. Additional Items to Consider
        4. Summary
    19. Index
    20. Code Snippets