Book Image

Visual Studio 2019 Tricks and Techniques

By : Paul Schroeder, Aaron Cure
Book Image

Visual Studio 2019 Tricks and Techniques

By: Paul Schroeder, Aaron Cure

Overview of this book

Visual Studio 2019 (VS 2019) and Visual Studio Code (VS Code) are powerful professional development tools that help you to develop applications for any platform with ease. Whether you want to create web, mobile, or desktop applications, Microsoft Visual Studio is your one-stop solution. This book demonstrates some of the most sophisticated capabilities of the tooling and shows you how to use the integrated development environment (IDE) more efficiently to be more productive. You’ll begin by gradually building on concepts, starting with the basics. The introductory chapters cover shortcuts, snippets, and numerous optimization tricks, along with debugging techniques, source control integration, and other important IDE features that will help you make your time more productive. With that groundwork in place, more advanced concepts such as the inner workings of project and item templates are covered. You will also learn how to write quality, secure code more efficiently as well as discover how certain Visual Studio features work 'under the hood'. By the end of this Visual Studio book, you’ll have learned how to write more secure code faster than ever using your knowledge of the extensions and processes that make developing successful solutions more enjoyable and repeatable.
Table of Contents (21 chapters)
1
Section 1: Visual Studio IDE Productivity Essentials
9
Section 2: Customizing Project Templates and Beyond
13
Section 3: Leveraging Extensions for the Win

What this book covers

Chapter 1, Flavors of Visual Studio, is primarily for those new to programming or .NET development. This chapter describes the key factors to consider when deciding which version of Visual Studio is right for you.

Chapter 2, Keyboard Shortcuts, shows how most tasks can be performed directly from the keyboard, without a mouse. It pulls back the curtain on the magic of keyboard shortcuts in Visual Studio 2019 for Windows and teaches you how to customize the tool.

Chapter 3, IDE Tips and Tricks, demonstrates ways to organize code files and quickly navigate in the IDE/solution files. How to access preview features and use Live Sharing is covered, as well as tips for faster code insertion and editing.

Chapter 4, Working with a Repository, provides all the basic knowledge you need to know to work with Git source control via Visual Studio. It covers how to create/clone a repo as well as how to add files, get updates, and commit code. Branching, merging, and pull requests are also topics.

Chapter 5, Working with Snippets, explains how to use snippets that come pre-installed with Visual Studio, how to manage them with the Code Snippets Manager dialog, and even how to make and import your own custom creations.

Chapter 6, Database Explorers, teaches you how to manage databases in Visual Studio 2019 for Windows as well as Visual Studio Code, and how to create a database, table, and data rows. Then, you'll see how to select and export that data.

Chapter 7, Compiling, Debugging, and Version Control, explores conditional compilation symbols, breakpoints, and immediate and watch windows. How to install Docker is covered before remote debugging is performed in a hands-on exercise using a Docker container. An automated approach to versioning assemblies wraps up this chapter.

Chapter 8, Introduction to Project and Item Templates, is a primer for the chapters that follow. It includes information on when to use templates and how template tags work. The sample project that is used in subsequent chapters is introduced here.

Chapter 9, Creating Your Own Templates, demonstrates how to export and import custom project templates to/from Visual Studio. You will create a new project using a custom template, provided in the download accompanying this book, identify and fix issues with it, and then learn how to make your own project item template.

Chapter 10, Deploying Custom Templates, contains more advanced content leveraging knowledge gained in the two prior chapters. You are guided step by step through an exercise that examines VSIX deployment package creation for a sample client-server solution. By the end, a multi-project template, complete with an IWizard UI implementation, is ready to go. Simply add a new project, enter a database connection string, and out pops a working Web API server sending data down to a WPF client. Information on how to distribute your custom templates to the marketplace rounds out this chapter.

Chapter 11, Overviewing Visual Studio 2019 Extensions, eases in with an introduction to extensions and searching for them in Visual Studio Marketplace. Learn how to manage them and how to create them in both Windows and Mac. Finish with a tour of Roslyn analyzers and create one that analyzes code related to the extension created in the prior exercise.

Chapter 12, Overviewing VS Code Extensions, is dedicated to extensions in Visual Studio Code. How to create extensions is covered through a step-by-step exercise that is designed to put a licensing header at the top of code files. The chapter ends with how to create a VSIX installer file to share the extension or deploy it to the marketplace.

Chapter 13, CodeMaid Is Your Friend, extolls the benefits of organized code, along with a brief history of this popular extension, CodeMaid. Cleanup actions and features such as CodeMaid Spade are explored along with the many configurable options available.

Chapter 14, Be Your Team's Hero with CodeGenHero™, studies a unique perspective on code generation. You are guided through an example project where many classes are auto-generated, including the web API and client-side data access components. Key topics such as how to configure a metadata source, blueprints, choosing templates, configuring parameters, and merging output results are covered. Changing the database schema and regenerating the source code adds a finishing touch.

Chapter 15, Secure Code with Puma Scan, helps you understand common application security vulnerabilities such as SQLi, XSS, and security misconfiguration. It talks about how to find vulnerabilities for fun and profit before automating vulnerability detection using the Puma Scan extension. How to extend Puma Scan with custom sinks is discussed as well as how to incorporate it into a DevSecOps pipeline.

Chapter 16, Other Popular Productivity Extensions, is a great, light way to close out this book. This chapter provides an overview of great extensions for Visual Studio, favorite extensions for Visual Studio Code, and some useful extensions for Visual Studio for Mac. Whereas prior chapters on extensions went deep with exercises, this one goes wide. Information is provided on 15 different extensions that can improve your developer experience.