Visual Studio® 2015
Total Page:16
File Type:pdf, Size:1020Kb
PROFESSIONAL Visual Studio® 2015 Bruce Johnson ffi rs.indd 08/06/2015 Page i Professional Visual Studio® 2015 Published by John Wiley & Sons, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2015 by John Wiley & Sons, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 978-1-119-06805-1 ISBN: 978-1-119-06791-7 (ebk) ISBN: 978-1-119-06787-0 (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 specifi cally disclaim all warranties, including without limitation warranties of fi tness 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, read ers 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 stan- dard 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: 2015942780 Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are trade- marks or registered trademarks of John Wiley & Sons, Inc. and/or its affi liates, in the United States and other countries, and may not be used without written permission. 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. ffi rs.indd 08/06/2015 Page ii I’d like to thank my wife, Ali, and 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. Unless they needed a ride somewhere, that is. But they are my loves and my life would be much less rich without them. ffi rs.indd 08/06/2015 Page iii ABOUT THE AUTHOR BRUCE JOHNSON is a partner at ObjectSharp Consulting and a 30-year veteran of the computer industry. The fi rst 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 rich 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 Certifi ed Trainer (MCT) and is the 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 ten years. ABOUT THE TECHNICAL EDITOR GEORGE EVJEN is the Executive Vice President of Operations for Six0Run, a cloud-based collegiate recruiting and athletics management software application. George also serves as the Director of Development for ArchitectNow, a St. Louis–based consulting company specializing in custom client application architecture, design, and development, with clients ranging from small technology start- ups to global enterprises. Prior to his involvement in the software industry, George spent more than a dozen years coaching men’s basketball at all levels of the collegiate ranks. You can fi nd out more about George and ArchitectNow’s capabilities at http://www.architectnow.net. ffi rs.indd 08/06/2015 Page v CREDITS ACQUISITIONS EDITOR PROFESSIONAL TECHNOLOGY & Kenyon Brown STRATEGY DIRECTOR Barry Pruett PROJECT EDITOR Kelly Talbot BUSINESS MANAGER Amy Knies TECHNICAL EDITOR George Evjen ASSOCIATE PUBLISHER Jim Minatel PRODUCTION EDITOR Saleem Hameed Sulthan PROJECT COORDINATOR, COVER Brent Savage COPY EDITOR Gill Editorial Services PROOFREADER Nancy Bell MANAGER OF CONTENT DEVELOPMENT & ASSEMBLY INDEXER Mary Beth Wakefi eld Nancy Guenther PRODUCTION MANAGER COVER DESIGNER Kathleen Wisor Wiley MARKETING DIRECTOR COVER IMAGE David Mayhew ©Getty Images/Joyoyo Chen MARKETING MANAGER Carrie Sherrill ffi rs.indd 08/06/2015 Page vii ACKNOWLEDGMENTS 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. And, as true as that is, the others who are part of the writing and editorial process never get enough of the credit. The fact that the book is clear, accurate, and useful is because of the contribution of my editor, technical editor, and copy editor. And the people who do the production work. And the cover. And any other part of the book that I have forgotten to mention. I’m grateful for the help and have enjoyed working with such talented people. 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 impres- sive. I suspect he was forced to work with me again, but I can’t tell for sure. Thanks also go to George Evjen, who did a fantastic job making sure that the technical mistakes I made in my fi rst draft were cleaned up before publication. Finally, thanks to Karen Gill, who had to read what I wrote before it had been made grammatically correct. The efforts of all of these individuals are what make the book possible and, hopefully, a success. ffi rs.indd 08/06/2015 Page ix CONTENTS INTRODUCTION xxxix PART I: INTEGRATED DEVELOPMENT ENVIRONMENT 1 CHAPTER 1: A QUICK TOUR 3 Getting Started 3 Installing Visual Studio 2015 3 Running Visual Studio 2015 6 Is Visual Studio Really Cloud Enabled? 7 The Visual Studio IDE 10 Developing, Building, Debugging, and Deploying Your First Application 12 Summary 17 CHAPTER 2: THE SOLUTION EXPLORER, TOOLBOX, AND PROPERTIES 19 The Solution Explorer 20 Previewing Files 22 Common Tasks 23 Adding Projects and Items 25 Adding References 28 Adding Service References 29 Adding Connected Services 30 Adding Analyzers 31 Adding NuGet Packages 32 The Toolbox 35 Arranging Components 37 Adding Components 38 Properties 40 Extending the Properties Window 42 The Browsable Attribute 42 DisplayName Attribute 43 Description 43 Category 43 DefaultValue 44 AmbientValue 44 Summary 46 ftoc.indd 08/08/2015 Page xi CONTENTS CHAPTER 3: OPTIONS AND CUSTOMIZATIONS 47 The Start Page 48 Customizing the Start Page 49 Window Layout 49 Viewing Windows and Toolbars 50 Docking 50 Saving the Window Layout 53 The Editor Space 55 Navigating Open Items 57 Fonts and Colors 58 Visual Guides 59 Full-Screen Mode 60 Tracking Changes 61 Other Options 62 Keyboard Shortcuts 62 Quick Launch 63 Projects and Solutions 65 Build and Run 66 VB Options 67 Importing and Exporting Settings 67 Synchronized Settings 70 Summary 71 CHAPTER 4: THE VISUAL STUDIO WORKSPACE 73 The Code Editor 73 The Code Editor Window Layout 74 Regions 75 Outlining 75 Code Formatting 76 Navigating Forward/Backward 78 Additional Code Editor Features 78 Reference Highlighting 78 Code Zooming 78 Word Wrap 79 Line Numbers 79 Auto Brace Complete 80 Split View 80 Tear Away (Floating) Code Windows 81 Duplicating Solution Explorer 82 xii ftoc.indd 08/08/2015 Page xii CONTENTS