Professional Visual Studio 2013.pdf
www.it-ebooks.info
www.it-ebooks.info
PROFESSIONAL VISUAL STUDIO® 2013
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xliii
➤ PART I
INTEGRATED DEVELOPMENT ENVIRONMENT
CHAPTER 1
A Quick Tour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
CHAPTER 2
The Solution Explorer, Toolbox, and Properties . . . . . . . . . . . . . . . . 15
CHAPTER 3
Options and Customizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
CHAPTER 4
The Visual Studio Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
CHAPTER 5
Find and Replace and Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
➤ PART II
GETTING STARTED
CHAPTER 6
Solutions, Projects, and Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
CHAPTER 7
IntelliSense and Bookmarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
CHAPTER 8
Code Snippets and Refactoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
CHAPTER 9
Server Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
CHAPTER 10
Modeling with the Class Designer . . . . . . . . . . . . . . . . . . . . . . . . . . 167
➤ PART III
DIGGING DEEPER
CHAPTER 11
Unit Testing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
CHAPTER 12
Documentation with XML Comments . . . . . . . . . . . . . . . . . . . . . . . 201
CHAPTER 13
Code Consistency Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
CHAPTER 14
Code Generation with T4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
CHAPTER 15
Project and Item Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
CHAPTER 16
Language-Specific Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
➤ PART IV RICH CLIENT APPLICATIONS
CHAPTER 17
Windows Forms Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
CHAPTER 18
Windows Presentation Foundation (WPF) . . . . . . . . . . . . . . . . . . . . 307
CHAPTER 19
Office Business Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
CHAPTER 20
Windows Store Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Continues
www.it-ebooks.info
➤ PART V
WEB APPLICATIONS
CHAPTER 21
ASP.NET Web Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
CHAPTER 22
ASP.NET MVC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
CHAPTER 23
Silverlight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
CHAPTER 24
Dynamic Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
CHAPTER 25
SharePoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
CHAPTER 26
Windows Azure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
➤ PART VI DATA
CHAPTER 27
Visual Database Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
CHAPTER 28
DataSets and DataBinding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507
CHAPTER 29
Language Integrated Queries (LINQ) . . . . . . . . . . . . . . . . . . . . . . . 533
CHAPTER 30
The ADO.NET Entity Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
CHAPTER 31
Reporting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581
➤ PART VII APPLICATION SERVICES
CHAPTER 32
Windows Communication Foundation (WCF) . . . . . . . . . . . . . . . . . 617
CHAPTER 33
Windows Workflow Foundation (WF) . . . . . . . . . . . . . . . . . . . . . . . 637
CHAPTER 34
Client Application Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659
CHAPTER 35
Synchronization Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
CHAPTER 36
WCF RIA Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687
➤ PART VIII CONFIGURATION AND RESOURCES
CHAPTER 37
Configuration Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701
CHAPTER 38
Connection Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719
CHAPTER 39
Resource Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729
➤ PART IX DEBUGGING
CHAPTER 40
Using the Debugging Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749
CHAPTER 41
Debugging with Breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 767
CHAPTER 42
DataTips, Debug Proxies, and Visualizers . . . . . . . . . . . . . . . . . . . . 779
CHAPTER 43
Debugging Web Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791
CHAPTER 44
Advanced Debugging Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . 807
www.it-ebooks.info
➤ PART X
BUILD AND DEPLOYMENT
CHAPTER 45
Upgrading with Visual Studio 2013 . . . . . . . . . . . . . . . . . . . . . . . . . 829
CHAPTER 46
Build Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835
CHAPTER 47
Assembly Versioning and Signing . . . . . . . . . . . . . . . . . . . . . . . . . . 851
CHAPTER 48
Obfuscation, Application Monitoring, and Management . . . . . . . . 859
CHAPTER 49
Packaging and Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 879
CHAPTER 50
Web Application Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 893
➤ PART XI CUSTOMIZING AND EXTENDING VISUAL STUDIO
CHAPTER 51
The Automation Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 905
CHAPTER 52
Add-Ins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 913
CHAPTER 53
Managed Extensibility Framework (MEF) . . . . . . . . . . . . . . . . . . . . 927
➤ PART XII VISUAL STUDIO ULTIMATE
CHAPTER 54
Visual Studio Ultimate for Architects . . . . . . . . . . . . . . . . . . . . . . . . 949
CHAPTER 55
Visual Studio Ultimate for Developers . . . . . . . . . . . . . . . . . . . . . . . 961
CHAPTER 56
Visual Studio Ultimate for Testers . . . . . . . . . . . . . . . . . . . . . . . . . . 977
CHAPTER 57
Team Foundation Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 991
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1013
www.it-ebooks.info
www.it-ebooks.info
PROFESSIONAL
Visual Studio® 2013
www.it-ebooks.info
www.it-ebooks.info
PROFESSIONAL
Visual Studio® 2013
Bruce Johnson
www.it-ebooks.info
Professional Visual Studio® 2013
Published by
John Wiley & Sons, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright © 2014 by John Wiley & Sons, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-1-118-83204-2
ISBN: 978-1-118-83206-6 (ebk)
ISBN: 978-1-118-83205-9 (ebk)
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of
the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through
payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923,
(978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions
Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or
online at http://www.wiley.com/go/permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect
to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials.
The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding
that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is
required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable
for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or
Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this
work may have changed or disappeared 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 the
United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such
as a CD or DVD that is not included in the version you purchased, you may download this material at http://book
support.wiley.com. For more information about Wiley products, visit www.wiley.com.
Library of Congress Control Number: 2014930419
Trademarks: Wiley, 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 other countries, and may not be
used without written permission. Visual Studio is a registered trademark of Microsoft Corporation. All other trademarks
are the property of their respective owners. John Wiley & Sons, Inc., is not associated with any product or vendor mentioned in this book.
www.it-ebooks.info
I’d like to thank my wife, Ali, and my four children,
Kyle, Cameron, Gillian, and Curtis, for their love and
support. Throughout the process of writing this book,
they were well-behaved and completely respectful of my
time. Okay, that’s not true at all. But they are my loves
and my life would be much less rich without them.
www.it-ebooks.info
www.it-ebooks.info
ABOUT THE AUTHOR
BRUCE JOHNSON is a partner at ObjectSharp Consulting and a 30-year veteran of the computer industry.
The first third of his career was spent doing “real work,” otherwise known as coding in the UNIX world.
But for 20 years, he has been working on projects that are at the leading edge of Windows technology, from
C++ through Visual Basic to C#, and from thick client applications to websites to services.
As well as having fun with building systems, Bruce has spoken hundreds of times at conferences and user
groups throughout North America. He has been a Microsoft Certified Trainer (MCT) for the past four years
and he is a co-president of the Metro Toronto .NET User Group. He has also written columns and articles
for numerous magazines. While the quantity of the posts on his blog (http://blogs.objectsharp.com/
author/bruce.aspx) has decreased recently, the activity on his Twitter account (http://www.twitter
.com/lacanuck) has shown a corresponding increase. For all of this activity (or, perhaps, in spite of it),
Bruce has been privileged to be recognized as a Microsoft MVP for the past eight years.
www.it-ebooks.info
www.it-ebooks.info
CREDITS
ACQUISITIONS EDITOR
BUSINESS MANAGER
Mary James
Amy Knies
PROJECT EDITOR
VICE PRESIDENT AND EXECUTIVE
GROUP PUBLISHER
Kelly Talbot
Richard Swadley
TECHNICAL EDITOR
Andrew Moore
ASSOCIATE PUBLISHER
Jim Minatel
PRODUCTION EDITOR
Daniel Scribner
PROJECT COORDINATOR, COVER
Todd Klemme
COPY EDITOR
Charlotte Kughen
PROOFREADER
Louise Watson, Word One
EDITORIAL MANAGER
Mary Beth Wakefield
INDEXER
Johnna Dinse
FREELANCER EDITORIAL MANAGER
Rosemarie Graham
COVER DESIGNER
Wiley
ASSOCIATE DIRECTOR OF MARKETING
David Mayhew
COVER IMAGE
©philsajonesen/iStockphoto.com
MARKETING MANAGER
Ashley Zurcher
www.it-ebooks.info
www.it-ebooks.info
ACKNOWLEDGMENTS
TO THE OUTSIDE, it might look like the writing of a book is an individual effort. Having gone through
this act of creation a number of times, I can tell you that nothing is further from the truth. Yes, there is a
lot of effort on the part of the author (and the feeling of joy you get as you hand in your last rewrite is quite
palpable). But I can also tell you that without the rarely acknowledged efforts of the others involved in the
editorial process, the book would never have made it to completion. And if you, as the reader, take something useful from this book, odds are that my editor, my technical reviewer, and the project editor are the
reason why.
I would especially like to thank everyone at Wrox who has helped me through this process. In particular,
thanks go out to Kelly Talbot, whose patience and attention to detail are quite impressive. Thanks also go
to Andrew Moore, who did a great job making sure that the technical details of the book were accurate.
Finally, thanks to Charlotte Kughen, who had the unenviable chore of ensuring that I wasn’t writing in the
passive voice and fixed it when I stopped writing so well. The efforts of all of these individuals are what
make the book possible and, hopefully, a success. Thanks also to Mary James, who was kind enough to take
a chance on my ability to write.
www.it-ebooks.info
www.it-ebooks.info
CONTENTS
INTRODUCTION
xliii
PART I: INTEGRATED DEVELOPMENT ENVIRONMENT
CHAPTER 1: A QUICK TOUR
3
Getting Started
3
Installing Visual Studio 2013
Running Visual Studio 2013
Is Visual Studio Really Cloud Enabled?
The Visual Studio IDE
3
4
5
7
Developing, Building, Debugging, and Deploying
Your First Application
Summary
9
13
CHAPTER 2: THE SOLUTION EXPLORER, TOOLBOX,
AND PROPERTIES
The Solution Explorer
15
15
Previewing Files
Common Tasks
17
18
The Toolbox
23
Arranging Components
Adding Components
26
26
Properties
27
Extending the Properties Window
Summary
29
32
CHAPTER 3: OPTIONS AND CUSTOMIZATIONS
The Start Page
33
33
Customizing the Start Page
34
Window Layout
34
Viewing Windows and Toolbars
Navigating Open Items
Docking
The Editor Space
35
36
37
39
Fonts and Colors
Visual Guides
Full-Screen Mode
40
41
42
www.it-ebooks.info
CONTENTS
Tracking Changes
43
Other Options
43
Keyboard Shortcuts
Quick Launch
Projects and Solutions
Build and Run
VB Options
43
45
45
46
47
Importing and Exporting Settings
Synchronized Settings
47
49
Summary
50
CHAPTER 4: THE VISUAL STUDIO WORKSPACE
The Code Editor
51
51
The Code Editor Window Layout
Regions
Outlining
Code Formatting
Navigating Forward/Backward
Additional Code Editor Features
Split View
Tear Away (Floating) Code Windows
Duplicating Solution Explorer
Creating Tab Groups
Advanced Functionality
Code Navigation
51
52
53
53
54
54
56
56
58
58
59
60
Peek Definition
Enhanced Scrollbar
Navigate To
61
62
64
The Command Window
The Immediate Window
The Class View
The Error List
The Object Browser
The Code Definition Window
The Call Hierarchy Window
The Document Outline Tool Window
HTML Outlining
Control Outlining
65
66
67
68
68
69
70
71
71
71
Reorganizing Tool Windows
Summary
xviii
www.it-ebooks.info
73
74
CONTENTS
CHAPTER 5: FIND AND REPLACE AND HELP
Quick Find/Replace
75
75
Quick Find
Quick Replace
Find Options
Find and Replace Options
76
77
77
78
Find/Replace in Files
78
Find in Files
Find Dialog Options
Regular Expressions
Results Window
Replace in Files
78
79
80
81
82
Accessing Help
82
Navigating and Searching the Help System
Configuring the Help System
Summary
84
84
85
PART II: GETTING STARTED
CHAPTER 6: SOLUTIONS, PROJECTS,
AND ITEMS
Solution Structure
Solution File Format
Solution Properties
89
89
91
92
Common Properties
Configuration Properties
92
93
Project Types
Project Files Format
Project Properties
95
97
97
Application
Compile (Visual Basic Only)
Build (C# and F# Only)
Build Events (C# and F# Only)
Debug
References (Visual Basic Only)
Resources
Services
Settings
Reference Paths (C# and F# Only)
Signing
98
101
102
103
104
105
106
107
107
108
109
xix
www.it-ebooks.info
CONTENTS
My Extensions (Visual Basic Only)
Security
Publish
Code Analysis
109
110
111
112
Web Application Project Properties
112
Web
Silverlight Applications
Package/Publish Web
Package/Publish SQL
113
113
114
115
Web Site Projects
Summary
115
116
CHAPTER 7: INTELLISENSE AND BOOKMARKS
IntelliSense Explained
117
117
General IntelliSense
IntelliSense and C++
Completing Words and Phrases
Parameter Information
Quick Info
JavaScript IntelliSense
118
119
119
123
124
124
The JavaScript IntelliSense Context
Referencing Another JavaScript File
XAML IntelliSense
IntelliSense Options
125
125
126
127
General Options
Statement Completion
C#-Specific Options
127
128
129
Extended IntelliSense
129
Code Snippets
XML Comments
Adding Your Own IntelliSense
Bookmarks and the Bookmark Window
Summary
CHAPTER 8: CODE SNIPPETS AND REFACTORING
Code Snippets Revealed
129
130
130
130
132
133
133
Storing Code Blocks in the Toolbox
Code Snippets
Using Snippets in C#
Using Snippets in VB
Surround With Snippet
xx
www.it-ebooks.info
134
134
135
136
137
CONTENTS
Code Snippets Manager
Creating Snippets
Reviewing Existing Snippets
Using Snippets in XAML
Distributing Code Snippets
138
139
139
142
143
Accessing Refactoring Support
Refactoring Actions
144
144
Extract Method
Encapsulate Field
Extract Interface
Reorder Parameters
Remove Parameters
Rename
Generate Method Stub
Organize Usings
144
145
146
147
147
148
149
149
Summary
150
CHAPTER 9: SERVER EXPLORER
Server Connections
151
151
Event Logs
Management Classes
Management Events
Message Queues
Performance Counters
Services
152
154
156
158
160
163
Data Connections
SharePoint Connections
Summary
164
164
165
CHAPTER 10: MODELING WITH THE CLASS DESIGNER
Creating a Class Diagram
The Design Surface
The Toolbox
167
167
168
169
Entities
Connectors
169
170
The Class Details
The Properties Window
Layout
Exporting Diagrams
Code Generation and Refactoring
170
171
172
172
173
xxi
www.it-ebooks.info
CONTENTS
Drag-and-Drop Code Generation
IntelliSense Code Generation
Refactoring with the Class Designer
Summary
173
175
175
176
PART III: DIGGING DEEPER
CHAPTER 11: UNIT TESTING
Your First Test Case
179
179
Identifying Tests Using Attributes
Additional Test Attributes
Unit Tests and Code Lens
Asserting the Facts
184
185
187
188
The Assert Class
The StringAssert Class
The CollectionAssert Class
The ExpectedException Attribute
Initializing and Cleaning Up
TestInitialize and TestCleanup
ClassInitialize and ClassCleanup
AssemblyInitialize and AssemblyCleanup
Testing Context
188
189
189
189
191
191
191
191
192
Data
Writing Test Output
192
194
Advanced Unit Testing
195
Custom Properties
Testing Private Members
Testing Code Contracts
Summary
195
196
197
199
CHAPTER 12: DOCUMENTATION WITH XML COMMENTS
Inline Commenting
XML Comments
201
201
202
Adding XML Comments
XML Comment Tags
202
203
Using XML Comments
215
IntelliSense Information
216
Generating Documentation with GhostDoc
Compiling Documentation with Sandcastle
Task List Comments
Summary
xxii
www.it-ebooks.info
216
218
220
222
CONTENTS
CHAPTER 13: CODE CONSISTENCY TOOLS
Source Control
223
223
Selecting a Source Control Repository
Accessing Source Control
Coding Standards
224
225
228
Code Analysis with FxCop
Code Contracts
228
231
Summary
233
CHAPTER 14: CODE GENERATION WITH T4
235
Creating a T4 Template
T4 Building Blocks
235
238
Expression Blocks
Statement Blocks
Class Feature Blocks
239
239
241
How T4 Works
T4 Directives
242
244
Template Directive
Output Directive
Assembly Directive
Import Directive
Include Directive
244
245
245
245
246
Troubleshooting
247
Design-Time Errors
Compiling Transformation Errors
Executing Transformation Errors
Generated Code Errors
Generating Code Assets
Runtime Text Templates
247
247
248
248
248
252
Using Runtime Text Templates
Differences between Runtime Text Templates and
Standard T4 Templates
Tips and Tricks
Summary
253
255
256
257
CHAPTER 15: PROJECT AND ITEM TEMPLATES
259
Creating Templates
259
Item Template
Project Template
Template Structure
259
263
264
xxiii
www.it-ebooks.info
CONTENTS
Template Parameters
Template Locations
265
267
Extending Templates
267
Template Project Setup
IWizard
Generating the Extended Project Template
Starter Kits
Online Templates
Summary
267
268
273
274
275
275
CHAPTER 16: LANGUAGE-SPECIFIC FEATURES
Hitting a Nail with the Right Hammer
Imperative
Declarative
Dynamic
Functional
What’s It All Mean?
277
277
278
278
278
279
279
A Tale of Two Languages
The Async Keyword
Caller Information
280
280
282
Visual Basic
283
Iterators
The Global Keyword
283
283
F#
284
Your First F# Program
Exploring F# Language Features
Type Providers
Query Expressions
Auto-Implemented Properties
Summary
284
287
288
289
290
290
PART IV: RICH CLIENT APPLICATIONS
CHAPTER 17: WINDOWS FORMS APPLICATIONS
Getting Started
The Windows Form
293
293
294
Appearance Properties
Layout Properties
Window Style Properties
295
295
295
Form Design Preferences
296
xxiv
www.it-ebooks.info
CONTENTS
Adding and Positioning Controls
Vertically Aligning Text Controls
Automatic Positioning of Multiple Controls
Tab Order and Layering Controls
Locking Control Design
Setting Control Properties
Service-Based Components
Smart Tag Tasks
Container Controls
298
299
299
300
301
301
302
303
303
Panel and SplitContainer
FlowLayoutPanel
TableLayoutPanel
303
304
305
Docking and Anchoring Controls
Summary
CHAPTER 18: WINDOWS PRESENTATION FOUNDATION (WPF)
305
306
307
What Is WPF?
Getting Started with WPF
307
309
XAML Fundamentals
The WPF Controls
The WPF Layout Controls
311
312
313
The WPF Designer and XAML Editor
Working with the XAML Editor
Working with the WPF Designer
The Properties Tool Window
Data Binding Features
Styling Your Application
Windows Forms Interoperability
Hosting a WPF Control in Windows Forms
Hosting a Windows Forms Control in WPF
Debugging with the WPF Visualizer
Summary
CHAPTER 19: OFFICE BUSINESS APPLICATIONS
Choosing an Office Project Type
Document-Level Customizations
Application-Level Add-Ins
Creating a Document-Level Customization
Your First VSTO Project
Protecting the Document Design
315
316
317
319
323
326
327
328
329
330
332
333
333
334
335
335
335
338
xxv
www.it-ebooks.info
CONTENTS
Adding an Actions Pane
339
Creating an Application Add-In
Some Outlook Concepts
Creating an Outlook Form Region
Debugging Office Applications
Unregistering an Add-In
Disabled Add-Ins
340
340
341
345
345
346
Deploying Office Applications
Summary
CHAPTER 20: WINDOWS STORE APPLICATIONS
What Is a Windows Store Application?
Content before Chrome
Snap and Scale
Semantic Zoom
Contracts
Tiles
Embrace the Cloud
347
348
349
349
350
351
351
351
351
352
Creating a Windows Store Application
The Windows 8 Simulator
Your Windows Store Application
Summary
352
354
357
359
PART V: WEB APPLICATIONS
CHAPTER 21: ASP.NET WEB FORMS
Web Application versus Web Site Projects
Creating Web Projects
Creating a Web Site Project
Creating a Web Application Project
Designing Web Forms
363
363
364
365
368
371
The HTML Designer
Positioning Controls and HTML Elements
Formatting Controls and HTML Elements
CSS Tools
Validation Tools
Web Controls
371
373
375
375
378
380
Navigation Components
User Authentication
Data Components
380
380
382
xxvi
www.it-ebooks.info
CONTENTS
Web Parts
385
Master Pages
Rich Client-Side Development
385
387
Developing with JavaScript
Working with ASP.NET AJAX
Using AJAX Control Extenders
387
389
391
Summary
392
CHAPTER 22: ASP.NET MVC
395
Model View Controller
Getting Started with ASP.NET MVC
Choosing a Model
Controllers and Action Methods
MVC Scaffolding
396
396
398
399
399
Rendering a UI with Views
Advanced MVC
402
409
Routing
Action Method Parameters
Areas
Validation
Partial Views
Dynamic Data Templates
jQuery
409
412
415
417
419
419
422
Summary
424
CHAPTER 23: SILVERLIGHT
425
What Is Silverlight?
Getting Started with Silverlight
Navigation Framework
Theming
Enabling Running Out of Browser
Summary
CHAPTER 24: DYNAMIC DATA
Creating a Dynamic Data Web Application
Adding a Data Model
Exploring a Dynamic Data Application
Customizing the Data Model
Scaffolding Individual Tables
Customizing Individual Data Fields
425
426
432
433
435
438
439
440
441
443
444
445
445
xxvii
www.it-ebooks.info
CONTENTS
Adding Custom Validation Rules
Customizing the Display Format
Customizing the Presentation
Page Templates
Field Templates
Entity Templates
Filter Templates
447
448
449
450
453
455
457
Enabling Dynamic Data for Existing Projects
Summary
CHAPTER 25: SHAREPOINT
SharePoint Execution Models
Farm Solution
Sandbox Solution
App Model
460
460
461
461
461
462
462
Preparing the Development Environment
Exploring SharePoint 2013
Creating a SharePoint Project
Building Custom SharePoint Components
Developing Web Parts
Creating Content Types and Lists
Adding Event Receivers
Creating SharePoint Workflows
463
464
466
469
469
470
473
474
Working with Features
Packaging and Deployment
Summary
476
477
479
CHAPTER 26: WINDOWS AZURE
481
The Windows Azure Platform
482
The Compute Emulator
Table, Blob, and Queue Storage
Application Deployment
SQL Azure
AppFabric
484
485
488
492
494
Service Bus
Access Control Service
494
494
Azure Websites
Azure Virtual Machines
494
495
Connectivity
495
Summary
496
xxviii
www.it-ebooks.info
CONTENTS
PART VI: DATA
CHAPTER 27: VISUAL DATABASE TOOLS
Database Windows in Visual Studio 2013
Server Explorer
The Data Sources Window
SQL Server Object Explorer
499
499
500
504
505
Editing Data
Summary
506
506
CHAPTER 28: DATASETS AND DATABINDING
DataSets Overview
507
507
Adding a Data Source
The DataSet Designer
508
509
Binding Data
512
BindingSource
BindingNavigator
Data Source Selections
Saving Changes
Inserting New Items
Validation
Customized DataSets
BindingSource Chains and the DataGridView
Working with Data Sources
514
516
517
519
521
522
523
525
527
The Web Service Data Source
Browsing Data
Summary
529
530
532
CHAPTER 29: LANGUAGE INTEGRATED
QUERIES (LINQ)
533
LINQ Providers
Old-School Queries
Query Pieces
533
534
536
From
Select
Where
Group By
Custom Projections
Order By
536
537
537
538
539
539
Debugging and Execution
540
xxix
www.it-ebooks.info
CONTENTS
LINQ to XML
541
VB XML Literals
Creating XML with LINQ
542
542
Querying XML
Schema Support
LINQ to SQL
544
545
547
Creating the Object Model
Querying with LINQ to SQL
Binding LINQ to SQL Objects
LINQPad
Summary
547
549
554
556
557
CHAPTER 30: THE ADO.NET ENTITY FRAMEWORK
What Is the Entity Framework?
Comparison with LINQ to SQL
Entity Framework Concepts
Getting Started
Creating an Entity Model
The Entity Data Model Wizard
The Entity Framework Designer
Creating/Modifying Entities
Creating/Modifying Entity Associations
Entity Inheritance
Validating an Entity Model
Updating an Entity Model with Database Changes
Querying the Entity Model
LINQ to Entities Overview
Getting an Object Context
CRUD Operations
Navigating Entity Associations
Advanced Functionality
559
560
560
560
561
561
562
565
569
571
572
572
572
573
573
574
574
578
579
Updating a Database from an Entity Model
Adding Business Logic to Entities
Plain Old CLR Objects (POCO)
Summary
579
580
580
580
CHAPTER 31: REPORTING
581
Getting Started with Reporting
Designing Reports
Defining Data Sources
Reporting Controls
581
583
584
586
xxx
www.it-ebooks.info
CONTENTS
Expressions, Placeholders, and Aggregates
Custom Code
Report Layout
Subreports
The Report Wizard
Rendering Reports
598
602
606
607
609
610
The Report Viewer Controls
Generating the Report
Rendering Reports to Different Formats
Deploying Reports
Summary
610
611
612
613
614
PART VII: APPLICATION SERVICES
CHAPTER 32: WINDOWS COMMUNICATION FOUNDATION (WCF)
What Is WCF?
Getting Started
Defining Contracts
617
617
618
619
Creating the Service Contract
Creating the Data Contract
Configuring WCF Service Endpoints
Hosting WCF Services
Consuming a WCF Service
Summary
CHAPTER 33: WINDOWS WORKFLOW
FOUNDATION (WF)
What Is Windows Workflow Foundation?
Why Use Windows Workflow?
Workflow Concepts
Activities
Control Flow Activities
Expressions
Workflow Run Time/Scheduler
Bookmarks
Persistence
Tracking
Getting Started
The Workflow Foundation Designer
Creating a Workflow
Designing a Workflow
619
621
623
626
631
635
637
637
638
638
638
640
640
640
640
641
641
642
644
647
647
xxxi
www.it-ebooks.info
CONTENTS
Writing Code Activities
Executing a Workflow
Debugging Workflows
Testing Workflows
649
651
653
653
Hosting the Workflow Designer
Summary
CHAPTER 34: CLIENT APPLICATION SERVICES
Client Services
Role Authorization
User Authentication
Settings
Login Form
Offline Support
Summary
654
658
659
659
662
664
666
670
672
675
CHAPTER 35: SYNCHRONIZATION SERVICES
Occasionally Connected Applications
Server Direct
Getting Started with Synchronization Services
Synchronization Services over N-Tiers
Summary
CHAPTER 36: WCF RIA SERVICES
Getting Started
Domain Services
Domain Operations
677
677
678
681
685
686
687
687
689
692
Query Operations
Insert/Update/Delete Operations
Other Operation Types
Consuming a Domain Service in Silverlight
Summary
692
692
693
693
697
PART VIII: CONFIGURATION AND RESOURCES
CHAPTER 37: CONFIGURATION FILES
.Config Files
701
701
Machine.Config
Web.Config
App.Config
701
701
702
xxxii
www.it-ebooks.info
CONTENTS
Security.Config
ApplicationHost.Config
702
702
Configuration Schema
703
Section: configurationSections
Section: startup
Section: runtime
Section: system.runtime.remoting
Section: system.net
Section: cryptographySettings
Section: system.diagnostics
Section: system.web
Section: compiler
Configuration Attributes
Application Settings
703
704
704
705
705
706
706
706
707
707
708
Using appSettings
Project Settings
Dynamic Properties
Custom Configuration Sections
708
709
710
711
User Settings
Referenced Projects with Settings
Summary
715
716
718
CHAPTER 38: CONNECTION STRINGS
719
Connection String Wizard
SQL Server Format
In-Code Construction
Encrypting Connection Strings
LocalDB
Summary
CHAPTER 39: RESOURCE FILES
What Are Resources?
719
723
724
726
727
728
729
729
Text File Resources
Resx Resource Files
Binary Resources
Adding Resources
Embedding Files as Resources
Naming Resources
Accessing Resources
Designer Files
730
731
732
732
733
733
733
734
xxxiii
www.it-ebooks.info
CONTENTS
Resourcing Your Application
735
Control Images
736
Satellite Resources
737
Cultures
Creating Culture Resources
Loading Culture Resource Files
Satellite Culture Resources
Accessing Specifics
737
738
738
739
739
Bitmap and Icon Loading
Cross-Assembly Referencing
ComponentResourceManager
Coding Resource Files
739
740
740
741
ResourceReader and ResourceWriter
ResxResourceReader and ResxResourceWriter
Custom Resources
Summary
741
742
742
745
PART IX: DEBUGGING
CHAPTER 40: USING THE DEBUGGING WINDOWS
The Code Window
749
749
Breakpoints
DataTips
750
750
The Breakpoints Window
The Output Window
The Immediate Window
The Watch Windows
QuickWatch
Watch Windows 1–4
Autos and Locals
750
751
752
753
754
754
755
The Code Execution Windows
Call Stack
Threads
Modules
Processes
755
755
756
756
757
The Memory Windows
757
Memory Windows 1–4
Disassembly
Registers
758
758
759
IntelliTrace (Ultimate Edition Only)
xxxiv
www.it-ebooks.info
759
CONTENTS
The Parallel Debugging Windows
Parallel Stacks
Parallel Tasks
760
760
762
Exceptions
763
Customizing the Exception Assistant
Unwinding an Exception
Summary
764
765
766
CHAPTER 41: DEBUGGING WITH BREAKPOINTS
Breakpoints
767
767
Setting a Breakpoint
Adding Break Conditions
Working with Breakpoints
768
770
772
Tracepoints
773
Creating a Tracepoint
Output Messages
774
774
Execution Control
774
Stepping through Code
Moving the Execution Point
775
776
Edit and Continue
776
Rude Edits
Stop Applying Changes
776
777
Summary
777
CHAPTER 42: DATATIPS, DEBUG PROXIES,
AND VISUALIZERS
DataTips
Debugger Attributes
779
779
781
DebuggerBrowsable
DebuggerDisplay
DebuggerHidden
DebuggerStepThrough
DebuggerNonUserCode
DebuggerStepperBoundary
Type Proxies
781
782
782
783
784
784
784
Raw View
786
Visualizers
Advanced Techniques
786
788
Saving Changes to Your Object
Summary
788
790
xxxv
www.it-ebooks.info
CONTENTS
CHAPTER 43: DEBUGGING WEB APPLICATIONS
Debugging Server-Side ASP.NET Code
Web Application Exceptions
Edit and Continue
Error Handling
Debugging Client-Side JavaScript
Setting Breakpoints in JavaScript Code
Debugging Dynamically Generated JavaScript
Debugging ASP.NET AJAX JavaScript
The Page Inspector
Tracing
791
791
793
795
795
796
797
798
798
798
800
Page-Level Tracing
Application-Level Tracing
Trace Output
The Trace Viewer
Custom Trace Output
Health Monitoring
Summary
800
801
802
802
803
803
805
CHAPTER 44: ADVANCED DEBUGGING TECHNIQUES
Start Actions
Debugging with Code
807
807
809
The Debugger Class
The Debug and Trace Classes
809
810
Debugging Running Applications
811
Attaching to a Windows Process
Attaching to a Web Application
Remote Debugging
IntelliTrace
Code Map Debugging
811
812
813
815
816
.NET Framework Source
Multithreaded and Parallelized Application Debugging
Debugging SQL Server Stored Procedures
Mixed-Mode Debugging
Post-Mortem Debugging
Generating Dump Files
Debugging Dump Files
819
821
822
823
823
823
824
Summary
826
xxxvi
www.it-ebooks.info
CONTENTS
PART X: BUILD AND DEPLOYMENT
CHAPTER 45: UPGRADING WITH VISUAL
STUDIO 2013
Upgrading from Visual Studio 2012 or 2010
Upgrading to .NET Framework 4.5.1
Summary
CHAPTER 46: BUILD CUSTOMIZATION
829
829
832
833
835
General Build Options
Manual Dependencies
The Visual Basic Compile Page
835
838
838
Advanced Compiler Settings
Build Events
839
841
C# Build Pages
MSBuild
843
844
How Visual Studio Uses MSBuild
The MSBuild Schema
Assembly Versioning via MSBuild Tasks
Summary
844
847
848
849
CHAPTER 47: ASSEMBLY VERSIONING
AND SIGNING
Assembly Naming
Version Consistency
Strongly Named Assemblies
The Global Assembly Cache
Signing an Assembly
Summary
CHAPTER 48: OBFUSCATION, APPLICATION MONITORING,
AND MANAGEMENT
The MSIL Disassembler
Decompilers
Obfuscating Your Code
851
851
854
855
856
856
858
859
859
861
862
Dotfuscator and Analytics
Obfuscation Attributes
Words of Caution
862
866
868
Application Monitoring and Management
Tamper Defense
Runtime Intelligence Instrumentation and Analytics
870
871
873
xxxvii
www.it-ebooks.info
CONTENTS
Application Expiry
Application Usage Tracking
Summary
876
877
878
CHAPTER 49: PACKAGING AND DEPLOYMENT
Windows Installer XML Toolset
Building an Installer
Using Heat to Create Fragments
The Service Installer
ClickOnce
879
880
880
883
886
886
One Click to Deploy
One Click to Update
887
891
Summary
892
CHAPTER 50: WEB APPLICATION DEPLOYMENT
Web Deployment
893
893
Publishing a Web Application
Copy Web Site
Web Project Installers
The Web Platform Installer
Extending the Web Platform Installer
Summary
894
895
896
897
898
902
PART XI: CUSTOMIZING AND EXTENDING VISUAL STUDIO
CHAPTER 51: THE AUTOMATION MODEL
Visual Studio Extensibility Options
The Visual Studio Automation Model
An Overview of the Automation Model
Solutions and Projects
Windows and Documents
Commands
Debugger
Events
Summary
905
905
906
906
908
908
910
911
912
912
CHAPTER 52: ADD-INS
913
Developing an Add-In
913
The Add-In Wizard
Project Structure
913
916
xxxviii
www.it-ebooks.info
CONTENTS
Testing Your Add-In
The .AddIn File
The Connect Class
Creating a Tool Window
Accessing the Visual Studio Automation Model
Handling Visual Studio Events
Deploying Add-Ins
Summary
916
918
919
919
922
923
926
926
CHAPTER 53: MANAGED EXTENSIBILITY FRAMEWORK (MEF)
Getting Started with MEF
927
928
Imports and Exports
Contracts
Catalogs
Advanced MEF
929
931
932
933
The Visual Studio Editor
934
The Text Model Subsystem
The Text View Subsystem
The Classification Subsystem
The Operations Subsystem
Extending the Editor
934
934
935
935
935
Editor Extension Points
Editor Services
The Check Comment Highlighter Extension
Summary
937
940
940
946
PART XII: VISUAL STUDIO ULTIMATE
CHAPTER 54: VISUAL STUDIO ULTIMATE
FOR ARCHITECTS
Modeling Projects
949
949
UML Diagrams
UML Model Explorer
Using Layer Diagrams to Verify Application Architecture
Linking to Team Foundation Server
Exploring Code
950
954
954
956
956
The Architecture Explorer
Dependency Graphs
Generate Sequence Diagram
Summary
956
958
958
960
xxxix
www.it-ebooks.info
CONTENTS
CHAPTER 55: VISUAL STUDIO ULTIMATE FOR DEVELOPERS
Code Metrics
961
961
Lines of Code
Depth of Inheritance
Class Coupling
Cyclomatic Complexity
Maintainability Index
Excluded Code
962
963
963
963
963
963
Managed Code Analysis Tool
C/C++ Code Analysis Tool
Profiling Tools
Configuring Profiler Sessions
Reports
Standalone Profiler
IntelliTrace
Database Tools
964
965
965
966
967
968
969
970
Database Schemas
SQL-CLR Support
Database Refactoring
Schema Compare
Static Analysis
Transact-SQL Editor
Best Practices
970
971
973
974
975
975
975
Summary
976
CHAPTER 56: VISUAL STUDIO ULTIMATE FOR TESTERS
Automated Tests
977
977
Web Performance Tests
Load Tests
Coded UI Test
Generic Tests
Ordered Test
978
980
983
984
984
Relating Code and Tests
984
Code Coverage
984
Visual Studio Test Management
Microsoft Test Manager
Testing Center
Lab Center
986
986
987
989
Summary
990
xl
www.it-ebooks.info
CONTENTS
CHAPTER 57: TEAM FOUNDATION SERVER
991
Team Project
Process Templates
Work Item Tracking
992
992
995
Work Item Queries
Work Item Types
Adding Work Items
Work Item State
995
997
997
998
Excel and Project Integration
Excel
Project
998
998
998
Version Control
1000
Working from Solution Explorer
Check Out
Check In
Resolve Conflicts
Working Offline
Label
History
Annotate
Shelve
Branch
Merge
Team Foundation Build
Reporting and Business Intelligence
Team Portal
Documents
Process Guidance
SharePoint Lists
Dashboards
1000
1001
1001
1002
1003
1003
1005
1005
1006
1006
1008
1008
1010
1011
1011
1011
1011
1011
Summary
1012
INDEX
1013
xli
www.it-ebooks.info
www.it-ebooks.info
INTRODUCTION
THROUGHOUT ITS HISTORY, Visual Studio has incorporated the latest advances in Microsoft’s premier
programming languages (Visual Basic and C#), and this version is no different. But alongside support for
language features comes continuing support for developers. In theory, it is possible to create any .NET
application using tools as simple as Notepad and a command-line window. But the typical developer
would never think to do so. The tools and utilities that come with Visual Studio do more to increase the
productivity of developers than any other single piece of software currently available. Visual Studio 2013 is
no different from previous versions in this respect. It includes a host of improvements and new features that
are aimed at making the life of a developer easier.
Visual Studio 2013 is an enormous product no matter which way you look at it. It can be intimidating to
newcomers and difficult for even experienced .NET developers to find what they need. And that’s where this
book comes in. Professional Visual Studio 2013 looks at every major aspect of this developer tool, showing
you how to harness each feature and offering advice about how best to utilize the various components
effectively. It shows you the building blocks that make up Visual Studio 2013, breaking the user interface
down into manageable chunks for you to understand. It then expands on each of these components with
additional details about exactly how they work, both in isolation and in conjunction with other parts of
Visual Studio 2013, along with tools that are not included in the out-of-the-box product, to make your
development efforts even more efficient.
WHO THIS BOOK IS FOR
Professional Visual Studio 2013 is for developers who are new to Visual Studio as well as those
programmers who have some experience but want to learn about features they may have previously
overlooked.
Even if you are familiar with the way previous versions of Visual Studio worked, you may want to at least
skim over Part I. These chapters deal with the basic constructs that make up the user interface. In the past,
the basic interface didn’t change much from version to version. But as soon as you launch Visual Studio
2013 for the first time, you’ll notice that the user interface has gone through some significant changes. While
you can get by without Part I, some of the changes in Visual Studio 2013 can make you a more efficient
developer. And, after all, that’s what you’re looking to get out of this book.
If you’re just starting out, you’ll greatly benefit from the first part, where basic concepts are explained and
you’re introduced to the user interface and how to customize it to suit your own style.
WHAT THIS BOOK COVERS
Microsoft Visual Studio 2013 is arguably the most advanced integrated development environment (IDE)
available for programmers today. It is based on a long history of programming languages and interfaces and
has been influenced by many different variations on the theme of development environments.
In Visual Studio 2012, Microsoft completely revamped the user interface for the IDE. The changes in Visual
Studio 2013 are not nearly as revolutionary. Existing developers will find it, more or less, the same with
some splashes of color. But more important, newcomers to Visual Studio will find it easy to work with.
This book covers the breadth of Visual Studio 2013. Along the way, you will become more familiar and
comfortable with the interface.
www.it-ebooks.info
INTRODUCTION
Visual Studio 2013 comes in several versions: Express, Professional, Premium, and Ultimate. The majority
of this book deals with the Professional Edition of Visual Studio 2013, but some parts utilize features found
only in the Premium and Ultimate editions. If you haven’t used these editions before, read through Chapters
54 to 57 for an overview of the features they offer over and above the Professional Edition.
HOW THIS BOOK IS STRUCTURED
This book’s first section is dedicated to familiarizing you with the core aspects of Visual Studio 2013.
Everything you need is contained in the first five chapters, from the IDE structure and layout to the various
options and settings you can change to make the user interface synchronize with your own way of doing
things.
From there, the remainder of the book is broken into 11 parts:
➤
Getting Started: In this part, you learn how to take control of your projects and how to organize them
in ways that work with your own style.
➤
Digging Deeper: Though the many graphical components of Visual Studio that make a programmer’s
job easier are discussed in many places throughout this book, you often need help when you’re in the
process of actually writing code. This part deals with features that support the coding of applications
such as IntelliSense, code refactoring, and creating and running unit tests. The .NET Framework
supports dynamic languages and strengthens feature parity between the two primary .NET languages,
C# and VB. This part covers these languages, as well as looking at a range of features that will help
you write better and more consistent code.
➤
Rich Client Applications and Web Applications: For support with building everything from Office
add-ins to cloud applications, Visual Studio enables you to develop applications for a wide range of
platforms. These two parts cover the application platforms that are supported within Visual Studio
2013, including ASP.NET and Office, WPF, Silverlight 5, and ASP.NET MVC. Also, Chapter 20 takes
a look into the support provided for the Windows Store applications.
➤
Data: A large proportion of applications use some form of data storage. Visual Studio 2013 and the
.NET Framework include strong support for working with databases and other data sources. This
part examines how to use DataSets, the Visual Database Tools, LINQ, Synchronization Services, and
ADO.NET Entity Framework to build applications that work with data. It also shows you how you
can then present this data using Reporting.
➤
Application Services: Through the course of building an application, you are likely to require access to
services that may or may not reside within your organization. This part covers core technologies such
as WCF, WF, Synchronization Services, and WCF RIA services that you can use to connect to these
services.
➤
Configuration and Resources: The built-in support for configuration files allows you to adjust the way
an application functions on the fly without having to rebuild it. Furthermore, resource files can be
used to both access static data and easily localize an application into foreign languages and cultures.
This part of the book shows how to use .NET configuration and resource files.
➤
Debugging: Application debugging is one of the more challenging tasks developers have to tackle,
but correct use of the Visual Studio 2013 debugging features will help you analyze the state of the
application and determine the cause of any bugs. This part examines the debugging support provided
by the IDE.
➤
Build and Deployment: In addition to discussing how to build your solutions effectively and get
applications into the hands of your end users, this part also deals with the process of upgrading your
projects from previous versions.
xliv
www.it-ebooks.info
INTRODUCTION
➤
Customizing and Extending Visual Studio: If the functionality found in the previous part isn’t enough
to help you in your coding efforts, Visual Studio 2013 is even more extensible. This part covers the
automation model, how to write add-ins, and then how to use the Microsoft Extensibility Framework
(MEF) to extend Visual Studio 2013.
➤
Visual Studio Ultimate: The final part of the book examines the additional features only available in
the Premium and Ultimate versions of Visual Studio 2013. In addition, you’ll also learn how the Team
Foundation Server provides an essential tool for managing software projects.
Though this breakdown of the Visual Studio feature set provides the most logical and easily understood set
of topics, you may need to look for specific functions that will aid you in a particular activity. To address
this need, references to appropriate chapters are provided whenever a feature is covered in more detail
elsewhere in the book.
WHAT YOU NEED TO USE THIS BOOK
To use this book effectively, you’ll need only one additional item — Microsoft Visual Studio 2013
Professional Edition. With this software installed and the information found in this book, you’ll be able to
get a handle on how to use Visual Studio 2013 effectively in a very short period of time.
This book assumes that you are familiar with the traditional programming model, and it uses both the C#
and Visual Basic (VB) languages to illustrate features within Visual Studio 2013. In addition, it is assumed
that you can understand the code listings without an explanation of basic programming concepts in either
language. If you’re new to programming and want to learn Visual Basic, please take a look at Beginning
Visual Basic 2012 by Bryan Newsome. Similarly, if you are after a great book on C#, track down Beginning
Visual C# 2012, written collaboratively by a host of authors. While these books target the 2012 versions of
the languages, the vast majority of content will be applicable to 2013 as well.
Some chapters discuss additional products and tools that work in conjunction with Visual Studio. The
following are all available to download either on a trial basis or for free:
➤
Code Snippet Editor: This is a third-party tool developed for creating code snippets in VB. The
Snippet Editor tool is discussed in Chapter 8.
➤
Sandcastle: Using Sandcastle, you can generate comprehensive documentation for every member and
class within your solutions from the XML comments in your code. XML comments and Sandcastle
are discussed in Chapter 12.
➤
SQL Server 2012: The installation of Visual Studio 2013 includes an install of SQL Server 2012
Express, enabling you to build applications that use database files. However, for more comprehensive
enterprise solutions, you can use SQL Server 2012 instead. Database connectivity is covered in
Chapter 27.
➤
Visual Studio 2013 Premium or Ultimate Edition: These more advanced versions of Visual Studio
introduce tools for other parts of the development process such as testing and design. They are
discussed in Chapters 54–57.
➤
Team Foundation Server or Team Foundation Service: The server product (or the cloud-based
equivalent) that provides application lifecycle management throughout Visual
www.it-ebooks.info
PROFESSIONAL VISUAL STUDIO® 2013
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xliii
➤ PART I
INTEGRATED DEVELOPMENT ENVIRONMENT
CHAPTER 1
A Quick Tour . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
CHAPTER 2
The Solution Explorer, Toolbox, and Properties . . . . . . . . . . . . . . . . 15
CHAPTER 3
Options and Customizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
CHAPTER 4
The Visual Studio Workspace . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
CHAPTER 5
Find and Replace and Help . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
➤ PART II
GETTING STARTED
CHAPTER 6
Solutions, Projects, and Items . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
CHAPTER 7
IntelliSense and Bookmarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
CHAPTER 8
Code Snippets and Refactoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
CHAPTER 9
Server Explorer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151
CHAPTER 10
Modeling with the Class Designer . . . . . . . . . . . . . . . . . . . . . . . . . . 167
➤ PART III
DIGGING DEEPER
CHAPTER 11
Unit Testing. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179
CHAPTER 12
Documentation with XML Comments . . . . . . . . . . . . . . . . . . . . . . . 201
CHAPTER 13
Code Consistency Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223
CHAPTER 14
Code Generation with T4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 235
CHAPTER 15
Project and Item Templates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259
CHAPTER 16
Language-Specific Features . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 277
➤ PART IV RICH CLIENT APPLICATIONS
CHAPTER 17
Windows Forms Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 293
CHAPTER 18
Windows Presentation Foundation (WPF) . . . . . . . . . . . . . . . . . . . . 307
CHAPTER 19
Office Business Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333
CHAPTER 20
Windows Store Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 349
Continues
www.it-ebooks.info
➤ PART V
WEB APPLICATIONS
CHAPTER 21
ASP.NET Web Forms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 363
CHAPTER 22
ASP.NET MVC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
CHAPTER 23
Silverlight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 425
CHAPTER 24
Dynamic Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 439
CHAPTER 25
SharePoint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
CHAPTER 26
Windows Azure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
➤ PART VI DATA
CHAPTER 27
Visual Database Tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
CHAPTER 28
DataSets and DataBinding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507
CHAPTER 29
Language Integrated Queries (LINQ) . . . . . . . . . . . . . . . . . . . . . . . 533
CHAPTER 30
The ADO.NET Entity Framework . . . . . . . . . . . . . . . . . . . . . . . . . . . 559
CHAPTER 31
Reporting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 581
➤ PART VII APPLICATION SERVICES
CHAPTER 32
Windows Communication Foundation (WCF) . . . . . . . . . . . . . . . . . 617
CHAPTER 33
Windows Workflow Foundation (WF) . . . . . . . . . . . . . . . . . . . . . . . 637
CHAPTER 34
Client Application Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 659
CHAPTER 35
Synchronization Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 677
CHAPTER 36
WCF RIA Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 687
➤ PART VIII CONFIGURATION AND RESOURCES
CHAPTER 37
Configuration Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 701
CHAPTER 38
Connection Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 719
CHAPTER 39
Resource Files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 729
➤ PART IX DEBUGGING
CHAPTER 40
Using the Debugging Windows . . . . . . . . . . . . . . . . . . . . . . . . . . . . 749
CHAPTER 41
Debugging with Breakpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 767
CHAPTER 42
DataTips, Debug Proxies, and Visualizers . . . . . . . . . . . . . . . . . . . . 779
CHAPTER 43
Debugging Web Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 791
CHAPTER 44
Advanced Debugging Techniques . . . . . . . . . . . . . . . . . . . . . . . . . . 807
www.it-ebooks.info
➤ PART X
BUILD AND DEPLOYMENT
CHAPTER 45
Upgrading with Visual Studio 2013 . . . . . . . . . . . . . . . . . . . . . . . . . 829
CHAPTER 46
Build Customization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 835
CHAPTER 47
Assembly Versioning and Signing . . . . . . . . . . . . . . . . . . . . . . . . . . 851
CHAPTER 48
Obfuscation, Application Monitoring, and Management . . . . . . . . 859
CHAPTER 49
Packaging and Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 879
CHAPTER 50
Web Application Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 893
➤ PART XI CUSTOMIZING AND EXTENDING VISUAL STUDIO
CHAPTER 51
The Automation Model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 905
CHAPTER 52
Add-Ins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 913
CHAPTER 53
Managed Extensibility Framework (MEF) . . . . . . . . . . . . . . . . . . . . 927
➤ PART XII VISUAL STUDIO ULTIMATE
CHAPTER 54
Visual Studio Ultimate for Architects . . . . . . . . . . . . . . . . . . . . . . . . 949
CHAPTER 55
Visual Studio Ultimate for Developers . . . . . . . . . . . . . . . . . . . . . . . 961
CHAPTER 56
Visual Studio Ultimate for Testers . . . . . . . . . . . . . . . . . . . . . . . . . . 977
CHAPTER 57
Team Foundation Server . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 991
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1013
www.it-ebooks.info
www.it-ebooks.info
PROFESSIONAL
Visual Studio® 2013
www.it-ebooks.info
www.it-ebooks.info
PROFESSIONAL
Visual Studio® 2013
Bruce Johnson
www.it-ebooks.info
Professional Visual Studio® 2013
Published by
John Wiley & Sons, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256
www.wiley.com
Copyright © 2014 by John Wiley & Sons, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-1-118-83204-2
ISBN: 978-1-118-83206-6 (ebk)
ISBN: 978-1-118-83205-9 (ebk)
Manufactured in the United States of America
10 9 8 7 6 5 4 3 2 1
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of
the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through
payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923,
(978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions
Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or
online at http://www.wiley.com/go/permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect
to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials.
The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding
that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is
required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable
for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or
Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web sites listed in this
work may have changed or disappeared 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 the
United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such
as a CD or DVD that is not included in the version you purchased, you may download this material at http://book
support.wiley.com. For more information about Wiley products, visit www.wiley.com.
Library of Congress Control Number: 2014930419
Trademarks: Wiley, 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 other countries, and may not be
used without written permission. Visual Studio is a registered trademark of Microsoft Corporation. All other trademarks
are the property of their respective owners. John Wiley & Sons, Inc., is not associated with any product or vendor mentioned in this book.
www.it-ebooks.info
I’d like to thank my wife, Ali, and my four children,
Kyle, Cameron, Gillian, and Curtis, for their love and
support. Throughout the process of writing this book,
they were well-behaved and completely respectful of my
time. Okay, that’s not true at all. But they are my loves
and my life would be much less rich without them.
www.it-ebooks.info
www.it-ebooks.info
ABOUT THE AUTHOR
BRUCE JOHNSON is a partner at ObjectSharp Consulting and a 30-year veteran of the computer industry.
The first third of his career was spent doing “real work,” otherwise known as coding in the UNIX world.
But for 20 years, he has been working on projects that are at the leading edge of Windows technology, from
C++ through Visual Basic to C#, and from thick client applications to websites to services.
As well as having fun with building systems, Bruce has spoken hundreds of times at conferences and user
groups throughout North America. He has been a Microsoft Certified Trainer (MCT) for the past four years
and he is a co-president of the Metro Toronto .NET User Group. He has also written columns and articles
for numerous magazines. While the quantity of the posts on his blog (http://blogs.objectsharp.com/
author/bruce.aspx) has decreased recently, the activity on his Twitter account (http://www.twitter
.com/lacanuck) has shown a corresponding increase. For all of this activity (or, perhaps, in spite of it),
Bruce has been privileged to be recognized as a Microsoft MVP for the past eight years.
www.it-ebooks.info
www.it-ebooks.info
CREDITS
ACQUISITIONS EDITOR
BUSINESS MANAGER
Mary James
Amy Knies
PROJECT EDITOR
VICE PRESIDENT AND EXECUTIVE
GROUP PUBLISHER
Kelly Talbot
Richard Swadley
TECHNICAL EDITOR
Andrew Moore
ASSOCIATE PUBLISHER
Jim Minatel
PRODUCTION EDITOR
Daniel Scribner
PROJECT COORDINATOR, COVER
Todd Klemme
COPY EDITOR
Charlotte Kughen
PROOFREADER
Louise Watson, Word One
EDITORIAL MANAGER
Mary Beth Wakefield
INDEXER
Johnna Dinse
FREELANCER EDITORIAL MANAGER
Rosemarie Graham
COVER DESIGNER
Wiley
ASSOCIATE DIRECTOR OF MARKETING
David Mayhew
COVER IMAGE
©philsajonesen/iStockphoto.com
MARKETING MANAGER
Ashley Zurcher
www.it-ebooks.info
www.it-ebooks.info
ACKNOWLEDGMENTS
TO THE OUTSIDE, it might look like the writing of a book is an individual effort. Having gone through
this act of creation a number of times, I can tell you that nothing is further from the truth. Yes, there is a
lot of effort on the part of the author (and the feeling of joy you get as you hand in your last rewrite is quite
palpable). But I can also tell you that without the rarely acknowledged efforts of the others involved in the
editorial process, the book would never have made it to completion. And if you, as the reader, take something useful from this book, odds are that my editor, my technical reviewer, and the project editor are the
reason why.
I would especially like to thank everyone at Wrox who has helped me through this process. In particular,
thanks go out to Kelly Talbot, whose patience and attention to detail are quite impressive. Thanks also go
to Andrew Moore, who did a great job making sure that the technical details of the book were accurate.
Finally, thanks to Charlotte Kughen, who had the unenviable chore of ensuring that I wasn’t writing in the
passive voice and fixed it when I stopped writing so well. The efforts of all of these individuals are what
make the book possible and, hopefully, a success. Thanks also to Mary James, who was kind enough to take
a chance on my ability to write.
www.it-ebooks.info
www.it-ebooks.info
CONTENTS
INTRODUCTION
xliii
PART I: INTEGRATED DEVELOPMENT ENVIRONMENT
CHAPTER 1: A QUICK TOUR
3
Getting Started
3
Installing Visual Studio 2013
Running Visual Studio 2013
Is Visual Studio Really Cloud Enabled?
The Visual Studio IDE
3
4
5
7
Developing, Building, Debugging, and Deploying
Your First Application
Summary
9
13
CHAPTER 2: THE SOLUTION EXPLORER, TOOLBOX,
AND PROPERTIES
The Solution Explorer
15
15
Previewing Files
Common Tasks
17
18
The Toolbox
23
Arranging Components
Adding Components
26
26
Properties
27
Extending the Properties Window
Summary
29
32
CHAPTER 3: OPTIONS AND CUSTOMIZATIONS
The Start Page
33
33
Customizing the Start Page
34
Window Layout
34
Viewing Windows and Toolbars
Navigating Open Items
Docking
The Editor Space
35
36
37
39
Fonts and Colors
Visual Guides
Full-Screen Mode
40
41
42
www.it-ebooks.info
CONTENTS
Tracking Changes
43
Other Options
43
Keyboard Shortcuts
Quick Launch
Projects and Solutions
Build and Run
VB Options
43
45
45
46
47
Importing and Exporting Settings
Synchronized Settings
47
49
Summary
50
CHAPTER 4: THE VISUAL STUDIO WORKSPACE
The Code Editor
51
51
The Code Editor Window Layout
Regions
Outlining
Code Formatting
Navigating Forward/Backward
Additional Code Editor Features
Split View
Tear Away (Floating) Code Windows
Duplicating Solution Explorer
Creating Tab Groups
Advanced Functionality
Code Navigation
51
52
53
53
54
54
56
56
58
58
59
60
Peek Definition
Enhanced Scrollbar
Navigate To
61
62
64
The Command Window
The Immediate Window
The Class View
The Error List
The Object Browser
The Code Definition Window
The Call Hierarchy Window
The Document Outline Tool Window
HTML Outlining
Control Outlining
65
66
67
68
68
69
70
71
71
71
Reorganizing Tool Windows
Summary
xviii
www.it-ebooks.info
73
74
CONTENTS
CHAPTER 5: FIND AND REPLACE AND HELP
Quick Find/Replace
75
75
Quick Find
Quick Replace
Find Options
Find and Replace Options
76
77
77
78
Find/Replace in Files
78
Find in Files
Find Dialog Options
Regular Expressions
Results Window
Replace in Files
78
79
80
81
82
Accessing Help
82
Navigating and Searching the Help System
Configuring the Help System
Summary
84
84
85
PART II: GETTING STARTED
CHAPTER 6: SOLUTIONS, PROJECTS,
AND ITEMS
Solution Structure
Solution File Format
Solution Properties
89
89
91
92
Common Properties
Configuration Properties
92
93
Project Types
Project Files Format
Project Properties
95
97
97
Application
Compile (Visual Basic Only)
Build (C# and F# Only)
Build Events (C# and F# Only)
Debug
References (Visual Basic Only)
Resources
Services
Settings
Reference Paths (C# and F# Only)
Signing
98
101
102
103
104
105
106
107
107
108
109
xix
www.it-ebooks.info
CONTENTS
My Extensions (Visual Basic Only)
Security
Publish
Code Analysis
109
110
111
112
Web Application Project Properties
112
Web
Silverlight Applications
Package/Publish Web
Package/Publish SQL
113
113
114
115
Web Site Projects
Summary
115
116
CHAPTER 7: INTELLISENSE AND BOOKMARKS
IntelliSense Explained
117
117
General IntelliSense
IntelliSense and C++
Completing Words and Phrases
Parameter Information
Quick Info
JavaScript IntelliSense
118
119
119
123
124
124
The JavaScript IntelliSense Context
Referencing Another JavaScript File
XAML IntelliSense
IntelliSense Options
125
125
126
127
General Options
Statement Completion
C#-Specific Options
127
128
129
Extended IntelliSense
129
Code Snippets
XML Comments
Adding Your Own IntelliSense
Bookmarks and the Bookmark Window
Summary
CHAPTER 8: CODE SNIPPETS AND REFACTORING
Code Snippets Revealed
129
130
130
130
132
133
133
Storing Code Blocks in the Toolbox
Code Snippets
Using Snippets in C#
Using Snippets in VB
Surround With Snippet
xx
www.it-ebooks.info
134
134
135
136
137
CONTENTS
Code Snippets Manager
Creating Snippets
Reviewing Existing Snippets
Using Snippets in XAML
Distributing Code Snippets
138
139
139
142
143
Accessing Refactoring Support
Refactoring Actions
144
144
Extract Method
Encapsulate Field
Extract Interface
Reorder Parameters
Remove Parameters
Rename
Generate Method Stub
Organize Usings
144
145
146
147
147
148
149
149
Summary
150
CHAPTER 9: SERVER EXPLORER
Server Connections
151
151
Event Logs
Management Classes
Management Events
Message Queues
Performance Counters
Services
152
154
156
158
160
163
Data Connections
SharePoint Connections
Summary
164
164
165
CHAPTER 10: MODELING WITH THE CLASS DESIGNER
Creating a Class Diagram
The Design Surface
The Toolbox
167
167
168
169
Entities
Connectors
169
170
The Class Details
The Properties Window
Layout
Exporting Diagrams
Code Generation and Refactoring
170
171
172
172
173
xxi
www.it-ebooks.info
CONTENTS
Drag-and-Drop Code Generation
IntelliSense Code Generation
Refactoring with the Class Designer
Summary
173
175
175
176
PART III: DIGGING DEEPER
CHAPTER 11: UNIT TESTING
Your First Test Case
179
179
Identifying Tests Using Attributes
Additional Test Attributes
Unit Tests and Code Lens
Asserting the Facts
184
185
187
188
The Assert Class
The StringAssert Class
The CollectionAssert Class
The ExpectedException Attribute
Initializing and Cleaning Up
TestInitialize and TestCleanup
ClassInitialize and ClassCleanup
AssemblyInitialize and AssemblyCleanup
Testing Context
188
189
189
189
191
191
191
191
192
Data
Writing Test Output
192
194
Advanced Unit Testing
195
Custom Properties
Testing Private Members
Testing Code Contracts
Summary
195
196
197
199
CHAPTER 12: DOCUMENTATION WITH XML COMMENTS
Inline Commenting
XML Comments
201
201
202
Adding XML Comments
XML Comment Tags
202
203
Using XML Comments
215
IntelliSense Information
216
Generating Documentation with GhostDoc
Compiling Documentation with Sandcastle
Task List Comments
Summary
xxii
www.it-ebooks.info
216
218
220
222
CONTENTS
CHAPTER 13: CODE CONSISTENCY TOOLS
Source Control
223
223
Selecting a Source Control Repository
Accessing Source Control
Coding Standards
224
225
228
Code Analysis with FxCop
Code Contracts
228
231
Summary
233
CHAPTER 14: CODE GENERATION WITH T4
235
Creating a T4 Template
T4 Building Blocks
235
238
Expression Blocks
Statement Blocks
Class Feature Blocks
239
239
241
How T4 Works
T4 Directives
242
244
Template Directive
Output Directive
Assembly Directive
Import Directive
Include Directive
244
245
245
245
246
Troubleshooting
247
Design-Time Errors
Compiling Transformation Errors
Executing Transformation Errors
Generated Code Errors
Generating Code Assets
Runtime Text Templates
247
247
248
248
248
252
Using Runtime Text Templates
Differences between Runtime Text Templates and
Standard T4 Templates
Tips and Tricks
Summary
253
255
256
257
CHAPTER 15: PROJECT AND ITEM TEMPLATES
259
Creating Templates
259
Item Template
Project Template
Template Structure
259
263
264
xxiii
www.it-ebooks.info
CONTENTS
Template Parameters
Template Locations
265
267
Extending Templates
267
Template Project Setup
IWizard
Generating the Extended Project Template
Starter Kits
Online Templates
Summary
267
268
273
274
275
275
CHAPTER 16: LANGUAGE-SPECIFIC FEATURES
Hitting a Nail with the Right Hammer
Imperative
Declarative
Dynamic
Functional
What’s It All Mean?
277
277
278
278
278
279
279
A Tale of Two Languages
The Async Keyword
Caller Information
280
280
282
Visual Basic
283
Iterators
The Global Keyword
283
283
F#
284
Your First F# Program
Exploring F# Language Features
Type Providers
Query Expressions
Auto-Implemented Properties
Summary
284
287
288
289
290
290
PART IV: RICH CLIENT APPLICATIONS
CHAPTER 17: WINDOWS FORMS APPLICATIONS
Getting Started
The Windows Form
293
293
294
Appearance Properties
Layout Properties
Window Style Properties
295
295
295
Form Design Preferences
296
xxiv
www.it-ebooks.info
CONTENTS
Adding and Positioning Controls
Vertically Aligning Text Controls
Automatic Positioning of Multiple Controls
Tab Order and Layering Controls
Locking Control Design
Setting Control Properties
Service-Based Components
Smart Tag Tasks
Container Controls
298
299
299
300
301
301
302
303
303
Panel and SplitContainer
FlowLayoutPanel
TableLayoutPanel
303
304
305
Docking and Anchoring Controls
Summary
CHAPTER 18: WINDOWS PRESENTATION FOUNDATION (WPF)
305
306
307
What Is WPF?
Getting Started with WPF
307
309
XAML Fundamentals
The WPF Controls
The WPF Layout Controls
311
312
313
The WPF Designer and XAML Editor
Working with the XAML Editor
Working with the WPF Designer
The Properties Tool Window
Data Binding Features
Styling Your Application
Windows Forms Interoperability
Hosting a WPF Control in Windows Forms
Hosting a Windows Forms Control in WPF
Debugging with the WPF Visualizer
Summary
CHAPTER 19: OFFICE BUSINESS APPLICATIONS
Choosing an Office Project Type
Document-Level Customizations
Application-Level Add-Ins
Creating a Document-Level Customization
Your First VSTO Project
Protecting the Document Design
315
316
317
319
323
326
327
328
329
330
332
333
333
334
335
335
335
338
xxv
www.it-ebooks.info
CONTENTS
Adding an Actions Pane
339
Creating an Application Add-In
Some Outlook Concepts
Creating an Outlook Form Region
Debugging Office Applications
Unregistering an Add-In
Disabled Add-Ins
340
340
341
345
345
346
Deploying Office Applications
Summary
CHAPTER 20: WINDOWS STORE APPLICATIONS
What Is a Windows Store Application?
Content before Chrome
Snap and Scale
Semantic Zoom
Contracts
Tiles
Embrace the Cloud
347
348
349
349
350
351
351
351
351
352
Creating a Windows Store Application
The Windows 8 Simulator
Your Windows Store Application
Summary
352
354
357
359
PART V: WEB APPLICATIONS
CHAPTER 21: ASP.NET WEB FORMS
Web Application versus Web Site Projects
Creating Web Projects
Creating a Web Site Project
Creating a Web Application Project
Designing Web Forms
363
363
364
365
368
371
The HTML Designer
Positioning Controls and HTML Elements
Formatting Controls and HTML Elements
CSS Tools
Validation Tools
Web Controls
371
373
375
375
378
380
Navigation Components
User Authentication
Data Components
380
380
382
xxvi
www.it-ebooks.info
CONTENTS
Web Parts
385
Master Pages
Rich Client-Side Development
385
387
Developing with JavaScript
Working with ASP.NET AJAX
Using AJAX Control Extenders
387
389
391
Summary
392
CHAPTER 22: ASP.NET MVC
395
Model View Controller
Getting Started with ASP.NET MVC
Choosing a Model
Controllers and Action Methods
MVC Scaffolding
396
396
398
399
399
Rendering a UI with Views
Advanced MVC
402
409
Routing
Action Method Parameters
Areas
Validation
Partial Views
Dynamic Data Templates
jQuery
409
412
415
417
419
419
422
Summary
424
CHAPTER 23: SILVERLIGHT
425
What Is Silverlight?
Getting Started with Silverlight
Navigation Framework
Theming
Enabling Running Out of Browser
Summary
CHAPTER 24: DYNAMIC DATA
Creating a Dynamic Data Web Application
Adding a Data Model
Exploring a Dynamic Data Application
Customizing the Data Model
Scaffolding Individual Tables
Customizing Individual Data Fields
425
426
432
433
435
438
439
440
441
443
444
445
445
xxvii
www.it-ebooks.info
CONTENTS
Adding Custom Validation Rules
Customizing the Display Format
Customizing the Presentation
Page Templates
Field Templates
Entity Templates
Filter Templates
447
448
449
450
453
455
457
Enabling Dynamic Data for Existing Projects
Summary
CHAPTER 25: SHAREPOINT
SharePoint Execution Models
Farm Solution
Sandbox Solution
App Model
460
460
461
461
461
462
462
Preparing the Development Environment
Exploring SharePoint 2013
Creating a SharePoint Project
Building Custom SharePoint Components
Developing Web Parts
Creating Content Types and Lists
Adding Event Receivers
Creating SharePoint Workflows
463
464
466
469
469
470
473
474
Working with Features
Packaging and Deployment
Summary
476
477
479
CHAPTER 26: WINDOWS AZURE
481
The Windows Azure Platform
482
The Compute Emulator
Table, Blob, and Queue Storage
Application Deployment
SQL Azure
AppFabric
484
485
488
492
494
Service Bus
Access Control Service
494
494
Azure Websites
Azure Virtual Machines
494
495
Connectivity
495
Summary
496
xxviii
www.it-ebooks.info
CONTENTS
PART VI: DATA
CHAPTER 27: VISUAL DATABASE TOOLS
Database Windows in Visual Studio 2013
Server Explorer
The Data Sources Window
SQL Server Object Explorer
499
499
500
504
505
Editing Data
Summary
506
506
CHAPTER 28: DATASETS AND DATABINDING
DataSets Overview
507
507
Adding a Data Source
The DataSet Designer
508
509
Binding Data
512
BindingSource
BindingNavigator
Data Source Selections
Saving Changes
Inserting New Items
Validation
Customized DataSets
BindingSource Chains and the DataGridView
Working with Data Sources
514
516
517
519
521
522
523
525
527
The Web Service Data Source
Browsing Data
Summary
529
530
532
CHAPTER 29: LANGUAGE INTEGRATED
QUERIES (LINQ)
533
LINQ Providers
Old-School Queries
Query Pieces
533
534
536
From
Select
Where
Group By
Custom Projections
Order By
536
537
537
538
539
539
Debugging and Execution
540
xxix
www.it-ebooks.info
CONTENTS
LINQ to XML
541
VB XML Literals
Creating XML with LINQ
542
542
Querying XML
Schema Support
LINQ to SQL
544
545
547
Creating the Object Model
Querying with LINQ to SQL
Binding LINQ to SQL Objects
LINQPad
Summary
547
549
554
556
557
CHAPTER 30: THE ADO.NET ENTITY FRAMEWORK
What Is the Entity Framework?
Comparison with LINQ to SQL
Entity Framework Concepts
Getting Started
Creating an Entity Model
The Entity Data Model Wizard
The Entity Framework Designer
Creating/Modifying Entities
Creating/Modifying Entity Associations
Entity Inheritance
Validating an Entity Model
Updating an Entity Model with Database Changes
Querying the Entity Model
LINQ to Entities Overview
Getting an Object Context
CRUD Operations
Navigating Entity Associations
Advanced Functionality
559
560
560
560
561
561
562
565
569
571
572
572
572
573
573
574
574
578
579
Updating a Database from an Entity Model
Adding Business Logic to Entities
Plain Old CLR Objects (POCO)
Summary
579
580
580
580
CHAPTER 31: REPORTING
581
Getting Started with Reporting
Designing Reports
Defining Data Sources
Reporting Controls
581
583
584
586
xxx
www.it-ebooks.info
CONTENTS
Expressions, Placeholders, and Aggregates
Custom Code
Report Layout
Subreports
The Report Wizard
Rendering Reports
598
602
606
607
609
610
The Report Viewer Controls
Generating the Report
Rendering Reports to Different Formats
Deploying Reports
Summary
610
611
612
613
614
PART VII: APPLICATION SERVICES
CHAPTER 32: WINDOWS COMMUNICATION FOUNDATION (WCF)
What Is WCF?
Getting Started
Defining Contracts
617
617
618
619
Creating the Service Contract
Creating the Data Contract
Configuring WCF Service Endpoints
Hosting WCF Services
Consuming a WCF Service
Summary
CHAPTER 33: WINDOWS WORKFLOW
FOUNDATION (WF)
What Is Windows Workflow Foundation?
Why Use Windows Workflow?
Workflow Concepts
Activities
Control Flow Activities
Expressions
Workflow Run Time/Scheduler
Bookmarks
Persistence
Tracking
Getting Started
The Workflow Foundation Designer
Creating a Workflow
Designing a Workflow
619
621
623
626
631
635
637
637
638
638
638
640
640
640
640
641
641
642
644
647
647
xxxi
www.it-ebooks.info
CONTENTS
Writing Code Activities
Executing a Workflow
Debugging Workflows
Testing Workflows
649
651
653
653
Hosting the Workflow Designer
Summary
CHAPTER 34: CLIENT APPLICATION SERVICES
Client Services
Role Authorization
User Authentication
Settings
Login Form
Offline Support
Summary
654
658
659
659
662
664
666
670
672
675
CHAPTER 35: SYNCHRONIZATION SERVICES
Occasionally Connected Applications
Server Direct
Getting Started with Synchronization Services
Synchronization Services over N-Tiers
Summary
CHAPTER 36: WCF RIA SERVICES
Getting Started
Domain Services
Domain Operations
677
677
678
681
685
686
687
687
689
692
Query Operations
Insert/Update/Delete Operations
Other Operation Types
Consuming a Domain Service in Silverlight
Summary
692
692
693
693
697
PART VIII: CONFIGURATION AND RESOURCES
CHAPTER 37: CONFIGURATION FILES
.Config Files
701
701
Machine.Config
Web.Config
App.Config
701
701
702
xxxii
www.it-ebooks.info
CONTENTS
Security.Config
ApplicationHost.Config
702
702
Configuration Schema
703
Section: configurationSections
Section: startup
Section: runtime
Section: system.runtime.remoting
Section: system.net
Section: cryptographySettings
Section: system.diagnostics
Section: system.web
Section: compiler
Configuration Attributes
Application Settings
703
704
704
705
705
706
706
706
707
707
708
Using appSettings
Project Settings
Dynamic Properties
Custom Configuration Sections
708
709
710
711
User Settings
Referenced Projects with Settings
Summary
715
716
718
CHAPTER 38: CONNECTION STRINGS
719
Connection String Wizard
SQL Server Format
In-Code Construction
Encrypting Connection Strings
LocalDB
Summary
CHAPTER 39: RESOURCE FILES
What Are Resources?
719
723
724
726
727
728
729
729
Text File Resources
Resx Resource Files
Binary Resources
Adding Resources
Embedding Files as Resources
Naming Resources
Accessing Resources
Designer Files
730
731
732
732
733
733
733
734
xxxiii
www.it-ebooks.info
CONTENTS
Resourcing Your Application
735
Control Images
736
Satellite Resources
737
Cultures
Creating Culture Resources
Loading Culture Resource Files
Satellite Culture Resources
Accessing Specifics
737
738
738
739
739
Bitmap and Icon Loading
Cross-Assembly Referencing
ComponentResourceManager
Coding Resource Files
739
740
740
741
ResourceReader and ResourceWriter
ResxResourceReader and ResxResourceWriter
Custom Resources
Summary
741
742
742
745
PART IX: DEBUGGING
CHAPTER 40: USING THE DEBUGGING WINDOWS
The Code Window
749
749
Breakpoints
DataTips
750
750
The Breakpoints Window
The Output Window
The Immediate Window
The Watch Windows
QuickWatch
Watch Windows 1–4
Autos and Locals
750
751
752
753
754
754
755
The Code Execution Windows
Call Stack
Threads
Modules
Processes
755
755
756
756
757
The Memory Windows
757
Memory Windows 1–4
Disassembly
Registers
758
758
759
IntelliTrace (Ultimate Edition Only)
xxxiv
www.it-ebooks.info
759
CONTENTS
The Parallel Debugging Windows
Parallel Stacks
Parallel Tasks
760
760
762
Exceptions
763
Customizing the Exception Assistant
Unwinding an Exception
Summary
764
765
766
CHAPTER 41: DEBUGGING WITH BREAKPOINTS
Breakpoints
767
767
Setting a Breakpoint
Adding Break Conditions
Working with Breakpoints
768
770
772
Tracepoints
773
Creating a Tracepoint
Output Messages
774
774
Execution Control
774
Stepping through Code
Moving the Execution Point
775
776
Edit and Continue
776
Rude Edits
Stop Applying Changes
776
777
Summary
777
CHAPTER 42: DATATIPS, DEBUG PROXIES,
AND VISUALIZERS
DataTips
Debugger Attributes
779
779
781
DebuggerBrowsable
DebuggerDisplay
DebuggerHidden
DebuggerStepThrough
DebuggerNonUserCode
DebuggerStepperBoundary
Type Proxies
781
782
782
783
784
784
784
Raw View
786
Visualizers
Advanced Techniques
786
788
Saving Changes to Your Object
Summary
788
790
xxxv
www.it-ebooks.info
CONTENTS
CHAPTER 43: DEBUGGING WEB APPLICATIONS
Debugging Server-Side ASP.NET Code
Web Application Exceptions
Edit and Continue
Error Handling
Debugging Client-Side JavaScript
Setting Breakpoints in JavaScript Code
Debugging Dynamically Generated JavaScript
Debugging ASP.NET AJAX JavaScript
The Page Inspector
Tracing
791
791
793
795
795
796
797
798
798
798
800
Page-Level Tracing
Application-Level Tracing
Trace Output
The Trace Viewer
Custom Trace Output
Health Monitoring
Summary
800
801
802
802
803
803
805
CHAPTER 44: ADVANCED DEBUGGING TECHNIQUES
Start Actions
Debugging with Code
807
807
809
The Debugger Class
The Debug and Trace Classes
809
810
Debugging Running Applications
811
Attaching to a Windows Process
Attaching to a Web Application
Remote Debugging
IntelliTrace
Code Map Debugging
811
812
813
815
816
.NET Framework Source
Multithreaded and Parallelized Application Debugging
Debugging SQL Server Stored Procedures
Mixed-Mode Debugging
Post-Mortem Debugging
Generating Dump Files
Debugging Dump Files
819
821
822
823
823
823
824
Summary
826
xxxvi
www.it-ebooks.info
CONTENTS
PART X: BUILD AND DEPLOYMENT
CHAPTER 45: UPGRADING WITH VISUAL
STUDIO 2013
Upgrading from Visual Studio 2012 or 2010
Upgrading to .NET Framework 4.5.1
Summary
CHAPTER 46: BUILD CUSTOMIZATION
829
829
832
833
835
General Build Options
Manual Dependencies
The Visual Basic Compile Page
835
838
838
Advanced Compiler Settings
Build Events
839
841
C# Build Pages
MSBuild
843
844
How Visual Studio Uses MSBuild
The MSBuild Schema
Assembly Versioning via MSBuild Tasks
Summary
844
847
848
849
CHAPTER 47: ASSEMBLY VERSIONING
AND SIGNING
Assembly Naming
Version Consistency
Strongly Named Assemblies
The Global Assembly Cache
Signing an Assembly
Summary
CHAPTER 48: OBFUSCATION, APPLICATION MONITORING,
AND MANAGEMENT
The MSIL Disassembler
Decompilers
Obfuscating Your Code
851
851
854
855
856
856
858
859
859
861
862
Dotfuscator and Analytics
Obfuscation Attributes
Words of Caution
862
866
868
Application Monitoring and Management
Tamper Defense
Runtime Intelligence Instrumentation and Analytics
870
871
873
xxxvii
www.it-ebooks.info
CONTENTS
Application Expiry
Application Usage Tracking
Summary
876
877
878
CHAPTER 49: PACKAGING AND DEPLOYMENT
Windows Installer XML Toolset
Building an Installer
Using Heat to Create Fragments
The Service Installer
ClickOnce
879
880
880
883
886
886
One Click to Deploy
One Click to Update
887
891
Summary
892
CHAPTER 50: WEB APPLICATION DEPLOYMENT
Web Deployment
893
893
Publishing a Web Application
Copy Web Site
Web Project Installers
The Web Platform Installer
Extending the Web Platform Installer
Summary
894
895
896
897
898
902
PART XI: CUSTOMIZING AND EXTENDING VISUAL STUDIO
CHAPTER 51: THE AUTOMATION MODEL
Visual Studio Extensibility Options
The Visual Studio Automation Model
An Overview of the Automation Model
Solutions and Projects
Windows and Documents
Commands
Debugger
Events
Summary
905
905
906
906
908
908
910
911
912
912
CHAPTER 52: ADD-INS
913
Developing an Add-In
913
The Add-In Wizard
Project Structure
913
916
xxxviii
www.it-ebooks.info
CONTENTS
Testing Your Add-In
The .AddIn File
The Connect Class
Creating a Tool Window
Accessing the Visual Studio Automation Model
Handling Visual Studio Events
Deploying Add-Ins
Summary
916
918
919
919
922
923
926
926
CHAPTER 53: MANAGED EXTENSIBILITY FRAMEWORK (MEF)
Getting Started with MEF
927
928
Imports and Exports
Contracts
Catalogs
Advanced MEF
929
931
932
933
The Visual Studio Editor
934
The Text Model Subsystem
The Text View Subsystem
The Classification Subsystem
The Operations Subsystem
Extending the Editor
934
934
935
935
935
Editor Extension Points
Editor Services
The Check Comment Highlighter Extension
Summary
937
940
940
946
PART XII: VISUAL STUDIO ULTIMATE
CHAPTER 54: VISUAL STUDIO ULTIMATE
FOR ARCHITECTS
Modeling Projects
949
949
UML Diagrams
UML Model Explorer
Using Layer Diagrams to Verify Application Architecture
Linking to Team Foundation Server
Exploring Code
950
954
954
956
956
The Architecture Explorer
Dependency Graphs
Generate Sequence Diagram
Summary
956
958
958
960
xxxix
www.it-ebooks.info
CONTENTS
CHAPTER 55: VISUAL STUDIO ULTIMATE FOR DEVELOPERS
Code Metrics
961
961
Lines of Code
Depth of Inheritance
Class Coupling
Cyclomatic Complexity
Maintainability Index
Excluded Code
962
963
963
963
963
963
Managed Code Analysis Tool
C/C++ Code Analysis Tool
Profiling Tools
Configuring Profiler Sessions
Reports
Standalone Profiler
IntelliTrace
Database Tools
964
965
965
966
967
968
969
970
Database Schemas
SQL-CLR Support
Database Refactoring
Schema Compare
Static Analysis
Transact-SQL Editor
Best Practices
970
971
973
974
975
975
975
Summary
976
CHAPTER 56: VISUAL STUDIO ULTIMATE FOR TESTERS
Automated Tests
977
977
Web Performance Tests
Load Tests
Coded UI Test
Generic Tests
Ordered Test
978
980
983
984
984
Relating Code and Tests
984
Code Coverage
984
Visual Studio Test Management
Microsoft Test Manager
Testing Center
Lab Center
986
986
987
989
Summary
990
xl
www.it-ebooks.info
CONTENTS
CHAPTER 57: TEAM FOUNDATION SERVER
991
Team Project
Process Templates
Work Item Tracking
992
992
995
Work Item Queries
Work Item Types
Adding Work Items
Work Item State
995
997
997
998
Excel and Project Integration
Excel
Project
998
998
998
Version Control
1000
Working from Solution Explorer
Check Out
Check In
Resolve Conflicts
Working Offline
Label
History
Annotate
Shelve
Branch
Merge
Team Foundation Build
Reporting and Business Intelligence
Team Portal
Documents
Process Guidance
SharePoint Lists
Dashboards
1000
1001
1001
1002
1003
1003
1005
1005
1006
1006
1008
1008
1010
1011
1011
1011
1011
1011
Summary
1012
INDEX
1013
xli
www.it-ebooks.info
www.it-ebooks.info
INTRODUCTION
THROUGHOUT ITS HISTORY, Visual Studio has incorporated the latest advances in Microsoft’s premier
programming languages (Visual Basic and C#), and this version is no different. But alongside support for
language features comes continuing support for developers. In theory, it is possible to create any .NET
application using tools as simple as Notepad and a command-line window. But the typical developer
would never think to do so. The tools and utilities that come with Visual Studio do more to increase the
productivity of developers than any other single piece of software currently available. Visual Studio 2013 is
no different from previous versions in this respect. It includes a host of improvements and new features that
are aimed at making the life of a developer easier.
Visual Studio 2013 is an enormous product no matter which way you look at it. It can be intimidating to
newcomers and difficult for even experienced .NET developers to find what they need. And that’s where this
book comes in. Professional Visual Studio 2013 looks at every major aspect of this developer tool, showing
you how to harness each feature and offering advice about how best to utilize the various components
effectively. It shows you the building blocks that make up Visual Studio 2013, breaking the user interface
down into manageable chunks for you to understand. It then expands on each of these components with
additional details about exactly how they work, both in isolation and in conjunction with other parts of
Visual Studio 2013, along with tools that are not included in the out-of-the-box product, to make your
development efforts even more efficient.
WHO THIS BOOK IS FOR
Professional Visual Studio 2013 is for developers who are new to Visual Studio as well as those
programmers who have some experience but want to learn about features they may have previously
overlooked.
Even if you are familiar with the way previous versions of Visual Studio worked, you may want to at least
skim over Part I. These chapters deal with the basic constructs that make up the user interface. In the past,
the basic interface didn’t change much from version to version. But as soon as you launch Visual Studio
2013 for the first time, you’ll notice that the user interface has gone through some significant changes. While
you can get by without Part I, some of the changes in Visual Studio 2013 can make you a more efficient
developer. And, after all, that’s what you’re looking to get out of this book.
If you’re just starting out, you’ll greatly benefit from the first part, where basic concepts are explained and
you’re introduced to the user interface and how to customize it to suit your own style.
WHAT THIS BOOK COVERS
Microsoft Visual Studio 2013 is arguably the most advanced integrated development environment (IDE)
available for programmers today. It is based on a long history of programming languages and interfaces and
has been influenced by many different variations on the theme of development environments.
In Visual Studio 2012, Microsoft completely revamped the user interface for the IDE. The changes in Visual
Studio 2013 are not nearly as revolutionary. Existing developers will find it, more or less, the same with
some splashes of color. But more important, newcomers to Visual Studio will find it easy to work with.
This book covers the breadth of Visual Studio 2013. Along the way, you will become more familiar and
comfortable with the interface.
www.it-ebooks.info
INTRODUCTION
Visual Studio 2013 comes in several versions: Express, Professional, Premium, and Ultimate. The majority
of this book deals with the Professional Edition of Visual Studio 2013, but some parts utilize features found
only in the Premium and Ultimate editions. If you haven’t used these editions before, read through Chapters
54 to 57 for an overview of the features they offer over and above the Professional Edition.
HOW THIS BOOK IS STRUCTURED
This book’s first section is dedicated to familiarizing you with the core aspects of Visual Studio 2013.
Everything you need is contained in the first five chapters, from the IDE structure and layout to the various
options and settings you can change to make the user interface synchronize with your own way of doing
things.
From there, the remainder of the book is broken into 11 parts:
➤
Getting Started: In this part, you learn how to take control of your projects and how to organize them
in ways that work with your own style.
➤
Digging Deeper: Though the many graphical components of Visual Studio that make a programmer’s
job easier are discussed in many places throughout this book, you often need help when you’re in the
process of actually writing code. This part deals with features that support the coding of applications
such as IntelliSense, code refactoring, and creating and running unit tests. The .NET Framework
supports dynamic languages and strengthens feature parity between the two primary .NET languages,
C# and VB. This part covers these languages, as well as looking at a range of features that will help
you write better and more consistent code.
➤
Rich Client Applications and Web Applications: For support with building everything from Office
add-ins to cloud applications, Visual Studio enables you to develop applications for a wide range of
platforms. These two parts cover the application platforms that are supported within Visual Studio
2013, including ASP.NET and Office, WPF, Silverlight 5, and ASP.NET MVC. Also, Chapter 20 takes
a look into the support provided for the Windows Store applications.
➤
Data: A large proportion of applications use some form of data storage. Visual Studio 2013 and the
.NET Framework include strong support for working with databases and other data sources. This
part examines how to use DataSets, the Visual Database Tools, LINQ, Synchronization Services, and
ADO.NET Entity Framework to build applications that work with data. It also shows you how you
can then present this data using Reporting.
➤
Application Services: Through the course of building an application, you are likely to require access to
services that may or may not reside within your organization. This part covers core technologies such
as WCF, WF, Synchronization Services, and WCF RIA services that you can use to connect to these
services.
➤
Configuration and Resources: The built-in support for configuration files allows you to adjust the way
an application functions on the fly without having to rebuild it. Furthermore, resource files can be
used to both access static data and easily localize an application into foreign languages and cultures.
This part of the book shows how to use .NET configuration and resource files.
➤
Debugging: Application debugging is one of the more challenging tasks developers have to tackle,
but correct use of the Visual Studio 2013 debugging features will help you analyze the state of the
application and determine the cause of any bugs. This part examines the debugging support provided
by the IDE.
➤
Build and Deployment: In addition to discussing how to build your solutions effectively and get
applications into the hands of your end users, this part also deals with the process of upgrading your
projects from previous versions.
xliv
www.it-ebooks.info
INTRODUCTION
➤
Customizing and Extending Visual Studio: If the functionality found in the previous part isn’t enough
to help you in your coding efforts, Visual Studio 2013 is even more extensible. This part covers the
automation model, how to write add-ins, and then how to use the Microsoft Extensibility Framework
(MEF) to extend Visual Studio 2013.
➤
Visual Studio Ultimate: The final part of the book examines the additional features only available in
the Premium and Ultimate versions of Visual Studio 2013. In addition, you’ll also learn how the Team
Foundation Server provides an essential tool for managing software projects.
Though this breakdown of the Visual Studio feature set provides the most logical and easily understood set
of topics, you may need to look for specific functions that will aid you in a particular activity. To address
this need, references to appropriate chapters are provided whenever a feature is covered in more detail
elsewhere in the book.
WHAT YOU NEED TO USE THIS BOOK
To use this book effectively, you’ll need only one additional item — Microsoft Visual Studio 2013
Professional Edition. With this software installed and the information found in this book, you’ll be able to
get a handle on how to use Visual Studio 2013 effectively in a very short period of time.
This book assumes that you are familiar with the traditional programming model, and it uses both the C#
and Visual Basic (VB) languages to illustrate features within Visual Studio 2013. In addition, it is assumed
that you can understand the code listings without an explanation of basic programming concepts in either
language. If you’re new to programming and want to learn Visual Basic, please take a look at Beginning
Visual Basic 2012 by Bryan Newsome. Similarly, if you are after a great book on C#, track down Beginning
Visual C# 2012, written collaboratively by a host of authors. While these books target the 2012 versions of
the languages, the vast majority of content will be applicable to 2013 as well.
Some chapters discuss additional products and tools that work in conjunction with Visual Studio. The
following are all available to download either on a trial basis or for free:
➤
Code Snippet Editor: This is a third-party tool developed for creating code snippets in VB. The
Snippet Editor tool is discussed in Chapter 8.
➤
Sandcastle: Using Sandcastle, you can generate comprehensive documentation for every member and
class within your solutions from the XML comments in your code. XML comments and Sandcastle
are discussed in Chapter 12.
➤
SQL Server 2012: The installation of Visual Studio 2013 includes an install of SQL Server 2012
Express, enabling you to build applications that use database files. However, for more comprehensive
enterprise solutions, you can use SQL Server 2012 instead. Database connectivity is covered in
Chapter 27.
➤
Visual Studio 2013 Premium or Ultimate Edition: These more advanced versions of Visual Studio
introduce tools for other parts of the development process such as testing and design. They are
discussed in Chapters 54–57.
➤
Team Foundation Server or Team Foundation Service: The server product (or the cloud-based
equivalent) that provides application lifecycle management throughout Visual