Professional Visual Studio® 2017
Published by
John Wiley & Sons, Inc.
10475 Crosspoint Boulevard
Indianapolis, IN 46256www.wiley.com
Copyright © 2018 by John Wiley & Sons, Inc., Indianapolis, Indiana
Published simultaneously in Canada
ISBN: 978-1-119-40458-3
ISBN: 978-1-119-40460-6 (ebk)
ISBN: 978-1-119-40459-0 (ebk)
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://booksupport.wiley.com
. For more information about Wiley products, visit www.wiley.com
.
Library of Congress Control Number: 2017953997
Trademarks: Wiley, the Wiley logo, 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.
I'd like to thank my four children, Kyle, Cameron, Gillian, and Curtis, for their love and support. All the kids are teenagers now, so they were quite happy to leave me alone to write as much as I needed. And this time around, some of them can drive. As a result, leaving me alone was even less demanding on them than it has been for past books. They are my loves and my life would be much less rich without them.
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 rich client applications to web applications and APIs, with a sprinkling of database and front-end development thrown in for good measure.
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) and the co-president of the Metro Toronto .NET User Group. He has also written columns and articles for numerous magazines. For all of this activity, Bruce was also a Microsoft MVP for more than ten years. At the moment, he's already working on the outline for his next book. Because why not?
JOHN MUELLER is a freelance author and technical editor. He has writing in his blood, having produced 104 books and more than 600 articles to date. The topics range from networking to artificial intelligence to database management to heads-down programming and beyond. Some of his current works include a book about machine learning, a couple of Python books, and a book about MATLAB. He has also written AWS for Admins for Dummies, which provides administrators with a great place to start with AWS, and AWS for Developers for Dummies, the counterpart for developers. His technical editing skills have helped more than 70 authors refine the content of their manuscripts. John has always been interested in development and has written about a wide variety of languages, including a highly successful C++ book. Be sure to read John's blog at http://blog.johnmuellerbooks.com.
You can reach John on the Internet at John@JohnMuellerBooks.com.
TO THE OUTSIDE, it might look like the writing of a book is an individual effort. It's not. Not even close. There is no way that this book could have come to fruition without the efforts and assistance of a number of people. The fact that the book is clear, accurate, and useful is because of the contributions of my editor, my technical editor, my copy editor, and the proofreader. And I haven't even gotten to those who are responsible for the production of the final copies. I'm incredibly grateful for everyone's help and have enjoyed working with these very talented people. It's makes the process a lot more enjoyable.
I would especially like to thank everyone at Wrox who has helped me through this process. In particular, thanks go out to Kelly Talbot. This is, if I'm not mistaken, the third or fourth book on which I have worked with Kelly. As always, his attention to detail has prevented a very large number of mistakes. But, more than that, he is not only patient, but diligent in ensuring that I meet my deadlines. Thanks also go to John Mueller, who not only made sure that the technical mistakes I made in my first draft were cleaned up before publication, but also provided some great suggestions that helped me clarify my writing. Finally, thanks to Nancy Bell, who had to slog through what I wrote and convert it to grammatically correct prose. The efforts of all of these individuals are what make the book possible and, hopefully, a success.
AS A TOOL FOR DEVELOPERS, Visual Studio stands head and shoulders about its competition. The team responsible for developing Visual Studio has always put the productivity of people who code for a living at the top of their priority list. This version continues this tradition. Visual Studio always incorporates the latest advances in Microsoft's premier programming languages (Visual Basic and C#), as well as adding little tidbits of functionality that are a boon to coders. But at a higher level, Visual Studio 2017 embraces open-source, mobile development, and cloud computing in a variety of ways. Azure is continually introducing new features and products and Visual Studio 2017 integrates seamlessly with them. While, in theory, it is possible to create any .NET application using tools as simple as Notepad and a command-line window, the typical developer would never think to do so. Visual Studio 2017, as was the case with its predecessors, includes a host of improvements and features that are aimed at making the life of a developer easier.
Visual Studio 2017 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 2017 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 2017, 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 2017, along with tools that are not included in the out-of-the-box product, to make your development efforts even more efficient.
Professional Visual Studio 2017 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. The biggest changes to the building blocks are in the installation process. It is more granular, meaning that you install only what you need and if you don't install a component initially, the installer is only a click or two away. But there are some little additions in functionality, so while you can get by without Part I, some of the changes in Visual Studio 2017 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.
Microsoft Visual Studio 2017 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.
Visual Studio 2017 does not represent a major departure from recent versions. Still, regardless of the type of application you're creating, there are tweaks that have been made—some small, some less so (.NET Core, for example). Familiarity with the changes helps you perform your job better. For this reason, as well as to help newcomers to Visual Studio, this book covers the breadth of the product. Along the way, you will become more familiar and comfortable with the interface.
Visual Studio 2017 comes in several versions: Community, Professional, and Enterprise. The majority of this book deals with the Professional Edition of Visual Studio 2017, but some chapters utilize features found only in the Enterprise edition. If you haven't used this edition before, read through Chapters 38 and 39 for an overview of the features it offers over and above the Professional Edition.
This book is divided into 11 parts:
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.
As Visual Studio has grown over the years, the size of earlier versions of this book had grown to the point where it was unwieldy. And there were even more features with Visual Studio 2017. So to avoid a book whose size would be pushing 2,000 pages, we took a number of the chapters from earlier editions of Visual Studio and put them into an online archive. These chapters contain features that have not been changed or enhanced in Visual Studio 2017. As such, the instructions found therein will apply, in general, if you're trying to use them in Visual Studio 2017. You can find the online archive on www.wrox.com
.
To use this book effectively, you'll need only one additional item — Microsoft Visual Studio 2017 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 2017 effectively in a very short period of time. In order to be able to follow along with all of the examples in the book, you'll want to be sure to install the following workloads during your Visual Studio 2017 installation (as discussed in Chapter 1):
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 2017. 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 2015 by Bryan Newsome. Similarly, if you are after a great book on C#, track down Beginning C# 6 Programming with Visual Studio 2015 by Benjamin Perkins, Jacob Vibe Hammer, and Jon D. Reid.
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:
To help you get the most from the text and keep track of what's happening, we've used a number of conventions throughout the book.
As for styles in the text:
persistence.properties
.We use a monofont type for code examples.
We use bold to emphasize code that is particularly important in the present context or to show changes from a previous code snippet.
As you work through the examples in this book, you may choose either to type in all the code manually or to use the source code files that accompany the book. All the source code used in this book is available for download at www.wrox.com.
You can also search for the book at www.wrox.com
by ISBN (the ISBN for this book is 978-1-119-40458-3) to find the code. And a complete list of code downloads for all current Wrox books is available at www.wrox.com/dynamic/books/download.aspx.
Alternately, you can go to the main Wrox code download page at www.wrox.com/dynamic/books/download.aspx
to see the code available for this book and all other Wrox books.
Most of the code on www.wrox.com
is compressed in a .ZIP, .RAR archive, or similar archive format appropriate to the platform. Once you download the code, just decompress it with your favorite compression tool.
We make every effort to ensure that there are no errors in the text or in the code. However, no one is perfect, and mistakes do occur. If you find an error in one of our books, like a spelling mistake or faulty piece of code, we would be very grateful for your feedback. By sending in errata you may save another reader hours of frustration and at the same time you will be helping us provide even higher quality information.
To find the errata page for this book, go to www.wrox.com
and locate the title using the Search box or one of the title lists. Then, on the Book Search Results page, click the Errata link. On this page you can view all errata that has been submitted for this book and posted by Wrox editors.
If you don't spot “your” error on the Errata page, click the Errata Form link and complete the form to send us the error you have found. We'll check the information and, if appropriate, post a message to the book's errata page and fix the problem in subsequent editions of the book.
For author and peer discussion, join the P2P forums at p2p.wrox.com
. The forums are a web-based system for you to post messages relating to Wrox books and related technologies and interact with other readers and technology users. The forums offer a subscription feature to email you topics of interest of your choosing when new posts are made to the forums. Wrox authors, editors, other industry experts, and your fellow readers are present on these forums.
At http://p2p.wrox.com
you will find a number of different forums that will help you, not only as you read this book, but also as you develop your own applications. To join the forums, just follow these steps:
p2p.wrox.com
and click the Register link.Once you join, you can post new messages and respond to messages other users post. You can read messages at any time on the Web. If you would like to have new messages from a particular forum emailed to you, click the Subscribe to this Forum icon by the forum name in the forum listing.
For more information about how to use the Wrox P2P, be sure to read the P2P FAQs for answers to questions about how the forum software works as well as many common questions specific to P2P and Wrox books. To read the FAQs, click the FAQ link on any P2P page.