Microsoft Visual Studio 2015 Unleashed

Lars Powers / Mike Snell  
Sams Publishing
Total pages
August 2015
Related Titles

Product detail

Product Price CHF Available  
Microsoft Visual Studio 2015 Unleashed
67.70 approx. 7-9 days


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.

New to this Edition

Since Visual Studio 2012, Microsoft has continued to refine and improve both the breadth and depth of the Visual Studio tool suite. This includes two major releases (Visual Studio 2013 released last year, and the upcoming release of Visual Studio 2014). The content and structure for this book will remain largely the same: it will focus, in depth, on how to use the Visual Studio IDE to perform a myriad of programming tasks. It will bring readers up to speed and close the gap from our last content refresh for Visual Studio 2012.
Key additions/changes to this edition would include updates to reflect core improvements with debugging, building, and refactoring, along with:
- Tighter integration with Azure
- Windows Phone 8.1 development
- Windows 8.1 development
- Hosted Visual Studio/Visual Studio online
- ASP vNext
- Single-page web apps (SPA)
- Cloud / Office Business Application projects
- CodeLens/Peek Definition
- “Monaco”
- Etc.

Table of Contents

Introduction   xxv

Part I Introducing Visual Studio 2015

1 A Quick Tour of Visual Studio 2015   1
The Visual Studio Product Line   2
Community Edition   3
Professional Edition   4
Enterprise   4
MSDN   5
TFS and Related Tools   5
Languages and Frameworks   8
Programming Language Choices   9
The .NET Framework   10
The Many Faces of a .NET Application   11
Windows   12
Web   13
Mobile   13
Developing Windows 8/10 Clients   14
Windows (WinForms)   14
Windows Presentation Foundation (WPF)   16
Office/SharePoint Solutions   18
Creating Web Applications with ASP.NET 5   20
Building Websites with Web Forms   21
Developing with MVC/Razor   24
Creating a Single Page Application (SPA)   25
Coding Web Services with Web API   27
Coding for Azure   28
Creating a Cloud Application   29
Publishing to Azure   30
Working with Data   31
Model as Code (Code First)   32
Writing Mobile Apps   37
Create an Apache Cordova App   38
Summary   40
2 The Visual Studio IDE   41
Installing Visual Studio   41
Installing Optional Features   42
Signing In to Visual Studio   43
Managing Your IDE Settings   44
Specify Stored and Synchronized Settings   44
Change Color Theme   45
Manually Import/Export and Change Default IDE Settings   46
Switch IDE User   50
Getting Started   51
Startup Options   52
Creating Your First Project   53
Targeting Your Environment   54
Navigating the IDE   56
The Menus   57
The Many Toolbars   63
Customizing Toolbars   64
The Solution Explorer   66
The Text Editors   68
The Visual Designers   72
The Toolbox   72
The Properties Window   73
Managing the Many Windows of the IDE   74
Pinning   74
Docking   75
Custom Window Layouts   77
Navigating IDE Windows   79
Touch Support   81
Customize Your IDE Font   81
Providing Feedback on Visual Studio   82
The Customer Experience Program   84
Summary   84
3 The .NET Languages   85
What’s New in C# 6.0 and VB 14   85
Null-Conditional Operators   86
ReadOnly Auto Properties   88
NameOf Expression   90
Using (Imports) Statics   91
String Interpolation   91
Lambda Expressions as Methods (C# Only)   92
Index Initializers (C# Only)   92
Language Primer   93
Programming Objects   93
Types, Variables, and Constants   109
Understanding Operators   113
Making Decisions and Branching Code   116
Looping   119
Working with Groups of Items   121
Programming with Attributes   126
Creating and Raising Events   128
Language Features   131
Infer a Variable’s Data Type Based on Assignment   132
Create an Object and Initialize Its Values (Object Initializers)   134
Define a Collection and Initialize Its Values   136
Creating an Instance of a Nonexistent Class   137
Add Methods to Existing Classes (Extension Methods)   138
Add Business Logic to Generated Code (Partial Methods)   139
Access and Query Data Using the .NET Languages   142
Write Simple Unnamed Functions Within Your Code (Lambda Expressions)   143
Splitting an Assembly Across Multiple Files   145
Working with XML Directly Within Your Code (VB Only)   146
Removing Unused Arguments from Event Handlers (VB Only)   147
Creating an Automatically Implemented Property   147
Dropping the Underscore in VB for Line Continuation   148
Working with Dynamic Languages/Objects   148
Covariance and Contravariance   155
Asynchronous Programming   157
The .NET Framework   159
A Map to the .NET Framework   159
Summary   161

Part II An In-Depth Look at the IDE

4 Solutions and Projects   163
Understanding Solutions   163
Creating a Solution   164
Working with Solutions   170
Getting Comfortable with Projects   177
Creating a Project   177
Working with Project Definition Files   181
Working with Projects   183
Summary   189
5 Browsers and Explorers   191
Leveraging the Solution Explorer   191
Visual Cues and Item Types   192
Interacting with Items   194
Inspecting Objects   198
Class View   201
Toolbar   202
Search Bar   203
Objects Pane   203
Members Pane   205
Server Explorer   206
Data Connections   207
Server Components   208
Azure   212
Object Browser   213
Changing the Scope   213
Browsing Objects   215
Document Outline   216
Editing Elements   218
Summary   218
6 Introducing the Editors and Designers   221
Getting Started with the Basics   221
The Text Editor   222
Visual Studio Designers   225
Coding with the Code Editor   225
Opening an Editor   226
Writing Code in the Code Editor   226
Anatomy of the Code Editor Window   228
Code Navigation Tools   233
Searching Documents   237
Debugging in the Text Editor   243
Printing Code   248
Using the Code Definition Window   250
Creating and Editing XML Documents and Schema   251
Inferring Schema   252
Designing XML Schemas   253
Editing XSLT Style Sheets   256
Working with Cascading Style Sheets   257
Adding Style Rules   258
Defining Style Sheet Attributes   258
Developing Windows Client Applications   258
Creating a Windows Forms Project   258
Creating a Windows Presentation Foundation Project   268
Developing Web Forms   271
Designing a Web Form Application   271
Authoring WinForms Components and Controls   277
Creating a New Component or Control   278
Further Notes on Writing Component Code   279
Creating Classes with the Class Designer   281
Creating a Class Diagram   281
Adding Items to the Diagram   282
Defining Relationships Between Classes   284
Defining Methods, Properties, Fields, and Events   286
Summary   288

Part III Working with the Visual Studio Tools

7 Working with Visual Studio’s Productivity Aids   289
Basic Aids in the Text Editor   291
Change Tracking   292
Coding Problem Indicators   293
Active Hyperlinking   295
Syntax Coloring   295
Outlining and Navigation   296
Code Outlining   296
Tag Navigation   299
Smart Tasks and Light Bulbs   301
HTML Designer   301
Windows Forms Designer   301
Code Editor   302
IntelliSense   305
Complete Word   306
Quick Info   308
List Members   309
Parameter Info   310
Organize Usings   311
Code Snippets and Template Code   311
Brace Matching   322
Customizing IntelliSense   324
The Task List   325
Shortcut Tasks   326
Comment Tasks   326
Summary   328
8 Testing Code   329
Unit Testing Basics   330
Creating a Test Project   330
Writing a Unit Test   333
Running Your Tests   336
Controlling Test Settings   338
The Unit Testing Framework   339
The TestContext Class   339
The Test Attribute Classes   341
Unit Test Setup and Teardown   342
The Assert Classes   344
Testing Your Exceptions   345
Creating Data-Driven Unit Tests   346
Testing Web Applications   350
Unit Testing MVC and Web API Projects   350
Unit Testing ASP.NET Pages   355
Creating Ordered Tests   357
Summary   358
9 Refactoring Code   361
Visual Studio Refactoring Basics   362
Invoking the Refactoring Tools   363
Making (and Previewing) Changes   364
Using the Class Designer to Refactor   366
Renaming Code   367
Accessing the Rename Operation   368
Working with the Rename Dialog Box   371
Refactoring Variable Assignments   372
Introduce Constant   372
Introduce Local   373
Inline Temporary Variable   375
Extract Method   375
Accessing the Extract Method Refactor   375
Extracting Methods   376
Extracting a Single Line of Code   380
Generate Method Stub   382
Extract Interface   382
Accessing the Extract Interface Refactor   383
Extracting Interfaces   383
Change Signature   385
Removing a Parameter   386
Reorder Parameters   387
Encapsulate Field   387
Accessing Encapsulate Field   387
Summary   389
10 Debugging Code   391
Debugging Basics   392
The Scenario   392
The Many Phases of Debugging   392
Debugging the Application (Self-Checking)   393
Debugging Basics Summary   404
The Visual Studio Debugger   405
The Debug Menu and Toolbar   405
Debug Options   413
Stepping In, Out, and Over Code   413
Indicating When to Break into Code   420
Working with Tracepoints (When Hit Option)   431
Viewing Data in the Debugger   433
Using the Edit and Continue Feature   441
Advanced Debugging Scenarios   442
Remote Debugging   442
Debugging WCF Services   444
Debugging Multithreaded Applications   444
Debugging Parallel Applications   451
Debugging a Client-Side Script   456
Debugging Crash Information (Dump Files)   457
Debugging Windows Store Apps   460
Summary   461
11 Deploying Code   463
An Overview of Client Deployment Options   464
Introducing ClickOnce Deployments   464
Introducing Windows Installer and InstallShield Deployments   465
Publishing a Project with ClickOnce   466
Publishing a Project with InstallShield Limited Edition   469
Publishing an ASP.NET Web Application   469
Selecting a Target   469
Configuring a Connection   471
Configuring Deployment Settings   472
Previewing the Publication   473
Summary   474
12 Developing Applications in the Cloud with Windows Azure   475
Create Your Azure Account   476
Azure Account Sign-Up   476
Link Your Account to Visual Studio   478
Manage Azure Subscriptions   479
Create and Deploy an Azure Web Apps in Visual Studio   480
The Azure Hosting Platform   481
Create the ASP.NET Application and Azure Hosting   481
Deploy/Publish an Application to Azure   484
Set Up an Existing Application to Publish to an Azure web app   489
Website Management with Azure Server Explorer   492
Debug an Azure web app   494
Create Your Web App from the Azure Portal   494
Create the Application Hosting Environment   494
Configuring Your New Azure web app   496
The Website Toolbar   499
Creating a Database   500
Deploying to the New Environment from Visual Studio   502
Monitor and Manage Applications in Azure   503
Monitor and Manage a Website   503
Monitor and Manage a SQL Database   518
The Azure SDK for Visual Studio 2015   522
Download, Install, and Sign In   522
QuickStart Templates   523
Azure Resource Group Deployment Projects   526
Azure Cloud Services (PaaS)   529
Creating a Cloud Service Project   530
Running Your Cloud Service Project Locally   532
Deploy the Cloud Service Project   532
Summary   534
13 Working with Databases   535
Creating Tables and Relationships   536
Creating a New SQL Server Database   536
Defining Tables   539
Working with SQL Statements   544
Writing a Query   544
Creating Views   548
Developing Stored Procedures   549
Creating Triggers   551
Creating User-Defined Functions   551
Using Database Projects   553
Creating a Database Project   554
Changing the Database   557
Building and Deploying   558
Creating Database Objects in Managed Code   559
Creating a Stored Procedure in C#   560
Binding Controls to Data   564
An Introduction to Data Binding   564
Autogenerating Bound Windows Forms Controls   565
Editing Typed Data Sets   570
Manually Binding Windows Forms Controls   571
Data Binding in WPF Applications   575
Data Binding with Web Controls   579
Object Relational Mapping   584
An Overview of LINQ   584
Mapping Using the O/R Designer   586
LINQ Code   588
Working with the Entity Framework   591
Querying Against the Entity Data Model   596
Summary   598

Part IV Extending Visual Studio

14 Introducing the Automation Object Model   601
An Overview of the Automation Object Model   601
Object Model Versions   602
Automation Categories   604
The DTE/DTE2 Root Object   605
Solution and Project Objects   606
Controlling Projects in a Solution   609
Accessing Code Within a Project   610
Working with Windows   614
Referencing Windows   614
Interacting with Windows   615
Text Windows and Window Panes   618
The Tool Window Types   620
Linked Windows   626
Command Bars   628
Documents   631
Text Documents   632
Command Objects   645
Executing a Command   647
Mapping Key Bindings   648
Debugger Objects   649
Summary   650
15 Extending the IDE   651
Creating Your First Extension   652
Setting Package Parameters   653
Adding Project Items   653
The Structure of an Extension   658
Defining and Reacting to Commands   660
A Sample Extension: Color Selector   668
Getting Started   668
Creating the User Control   668
Finishing the Package   673
Summary   682
16 Extending the Code Editor   683
The Extensibility Problem   683
Creating Dynamic Applications   684
MEF Architecture   684
MEF Principles   685
Working with MEF   685
The Visual Studio Editor and MEF   687
Editor Extension Points   687
Using the Visual Studio SDK   688
Managing Extensions and Updates   695
Creating Your Own MEF-Based Editor Extension   697
Summary   706

Part V Building Web Applications

17 Building Modern Websites with ASP.NET 5   707
ASP.NET Website Fundamentals   708
Introducing ASP.NET 5   710
The .NET Core Framework and Execution Environment   711
Choosing an ASP.NET Project Template   713
Understanding the ASP.NET 5 Project Template and Related Files   716
ASP.NET 5 Dependencies and Package Managers   721
Creating a Web Application with ASP.NET 5/MVC 6   735
Understanding the MVC Pattern   735
Creating a New ASP.NET 5 MVC 6 Project   738
Writing ASP.NET Server Code (Models and Controllers)   744
Defining a Model (Using Entity Framework 7)   744
Developing Controllers   753
Coding for the UI (Views and Related Web UI Elements)   760
The HTML Tags   760
The Razor Syntax   763
HTML Helpers   765
Page Layout with Razor   768
Strongly Typed Views   769
User Input Validation   770
Creating the Customer Example Pages   771
View Components, View Models, and Partial Views   779
Using Scaffolding to Generate a Controller and Views   788
Summary   791
18 Using JavaScript and Client-Side Frameworks   793
JavaScript Fundamentals   794
Storing and Using Scripts   794
Writing JavaScript   795
Functions   797
Objects   799
Built-In Objects   802
Working with the Browser Object Model (BOM)   805
Document Object Model (DOM)   808
Events   816
Developing with jQuery   819
jQuery in Your Visual Studio Project   820
Selecting Elements   821
Acting on Your Selection   824
Traversing Your Selections   824
Accessing Selection Content   825
Changing Elements/Attributes   826
Handling Events   828
Animations and Effects   829
jQuery and AJAX   831
Building Single-Page Applications (SPAs) with Client-Side JavaScript Frameworks   831
Selecting a Client Framework   832
Responsive Web Layout with Bootstrap 3   835
Minify Your JavaScript with Gulp   854
Using Knockout   857
Creating a Site with AngularJS   873
Summary   890
19 Building and Consuming Services with Web API and WCF   891
Service Fundamentals   892
Why ASP.NET Web API and WCF   893
Key Web Service Terms   895
Use ASP.NET Web API to Build HTTP Services   896
Creating an ASP.NET Web API Project   897
Defining a Model   898
Creating the Services (Controller)   900
Understanding Service Routing   911
Consuming an ASP.NET Web API Service   912
WCF Service Applications   928
The WCF Project Template   930
Creating a WCF Service   932
Running and Testing Your WCF Service   937
Consuming a WCF Service   938
Creating/Calling REST-Based WCF Services   942
Hosting and Deploying a WCF Service   949
Summary   951

Part VI Building Windows Client Apps

20 Building Windows Forms Applications   953
The Basics of Form Design   953
Considering the End User   954
Understanding the Role of UI Standards   955
Planning the User Interface   956
Creating a Form   957
The Windows Forms Application Project Type   957
Form Properties and Events   958
Adding Controls and Components   961
Control Layout and Positioning   962
Using Containers   967
Control Appearance and Behavior   971
Working with ToolStrip Controls   972
Displaying Data   979
Creating Your Own Controls   982
Subclassing an Existing Control   982
Designing a User Control   983
Creating a Custom Control   985
Summary   985
21 Building WPF Applications   987
The Windows Presentation Foundation Platform   987
Programming Model   990
Introducing the WPF Designer   993
XAML and Design Panes   993
Programming with WPF   998
Layout   998
Styles and Templates   1006
Data Binding   1012
Routed Events   1014
Building a Simple Image Viewer Application   1015
Starting the Layout   1016
Storing the Images   1023
Binding to the Images   1025
Button Event Handlers and Image Effects   1026
Path Selection with a Common Dialog Box   1028
Summary   1035
22 Developing Office Business Applications   1037
An Overview of Office Extension Features   1038
Office Features   1038
Visual Studio Office Project Types   1041
Creating an Office Add-In   1042
Customizing the Ribbon   1042
Customizing the Task Pane   1046
Creating Outlook Form Regions   1048
Creating an Office Document Extension   1053
Hosting Controls   1053
Creating an Actions Pane   1055
Storing Data in the Data Cache   1056
Extending Office with Webpages   1059
Starting with the App for Office Project Template   1059
Summary   1063

Part VII Creating Mobile Apps

23 Developing Windows Store Applications   1065
Introducing the Modern UI   1066
Modern UI Attributes   1068
The Windows Runtime Library   1070
Language Choices   1072
The Application Model   1076
Building a Windows Store Application   1077
Selecting the Project Type   1078
Designing the Layout   1080
Reacting to Lifecycle Events   1096
Publishing to the Windows Store   1100
Summary   1111
24 Creating Windows Phone Applications   1113
Windows Phone Fundamentals   1113
The UI Basics   1114
The Programming Model   1116
Moving from Silverlight to WinRT   1123
Porting a Simple Silverlight Phone App to WinRT   1124
Building a Universal App   1125
The Universal Project Types   1126
Creating the Data Model and View Model   1128
Creating the Windows Phone UI   1130
Creating the Windows UI   1141
Summary   1152
25 Writing Cross-Platform Mobile Applications with Apache Cordova   1153
Fundamentals of Cordova Development   1154
How Cordova Works   1154
Cordova Dependencies   1156
The Cordova Project Template   1157
Creating a Basic Cordova App   1160
Running and Debugging Your App   1165
Using Cordova Frameworks and Plug-Ins   1174
Choosing Cordova Client Frameworks   1174
Cordova Plug-Ins (for Accessing Native Device Capabilities)   1175
Developing a Cordova App with Ionic and Angular   1176
Set Up Your Project   1177
Anatomy of the Ionic-Angular-Cordova App   1180
Rebuild the Sample App   1181
Support Storage   1193
Running on Windows Phone   1196
Additional Items to Consider   1197
Summary   1198

Index   1199


Mike Snell spends his work life helping teams build great software that exceeds the expectations of end users. He runs the Solutions division at CEI ( ). Mike and his team deliver architecture, consulting, and mentoring to clients looking for help with enterprise projects, commercial software, mobile applications, or cloud-based solutions. He is also a Microsoft Regional director.

Lars Powers is currently the director of application development at Newgistics, Inc. Prior to Newgistics, he held various technical management positions at 3M and spent many years with Microsoft as a platform evangelist focused on emerging technologies.