
- •Table of Contents
- •About the Author
- •About the Technical Reviewer
- •Acknowledgments
- •Introduction
- •Installing Visual Studio
- •Visual Studio 2022 System Requirements
- •Operating Systems
- •Hardware
- •Supported Languages
- •Additional Notes
- •Visual Studio Is 64-Bit
- •Full .NET 6.0 Support
- •Using Workloads
- •The Solution Explorer
- •Toolbox
- •The Code Editor
- •New Razor Editor
- •What’s Available?
- •Hot Reload
- •Navigating Code
- •Navigate Forward and Backward Commands
- •Navigation Bar
- •Find All References
- •Find Files Faster
- •Reference Highlighting
- •Peek Definition
- •Subword Navigation
- •Features and Productivity Tips
- •Track Active Item in Solution Explorer
- •Hidden Editor Context Menu
- •Open in File Explorer
- •Finding Keyboard Shortcut Mappings
- •Clipboard History
- •Go To Window
- •Navigate to Last Edit Location
- •Multi-caret Editing
- •Sync Namespaces to Match Your Folder Structure
- •Paste JSON As Classes
- •Enable Code Cleanup on Save
- •Add Missing Using on Paste
- •Features in Visual Studio 2022
- •Visual Studio Search
- •Solution Filters
- •Visual Studio IntelliCode
- •Whole Line Completions
- •Visual Studio Live Share
- •Summary
- •Visual Studio Project Types
- •Various Project Templates
- •Console Applications
- •Windows Forms Application
- •Windows Service
- •Web Applications
- •Class Library
- •MAUI
- •Creating a MAUI Application
- •Pairing to Mac for iOS Development
- •Consuming REST Services in MAUI
- •The Complete Weather App
- •The Target Platforms
- •The Required NuGet Package
- •The Weather Models
- •The WeatherService
- •The MainViewModel
- •Registering Dependencies
- •Building the MainPage View
- •Using SQLite in a MAUI Application
- •The ToDoItem Model
- •The ToDoService
- •The MainViewModel
- •Registering Dependencies
- •Building the MainPage View
- •Managing NuGet Packages
- •Using NuGet in Visual Studio
- •Hosting Your Own NuGet Feeds
- •Managing nmp Packages
- •Creating Project Templates
- •Creating and Using Code Snippets
- •Creating Code Snippets
- •Using Bookmarks and Code Shortcuts
- •Bookmarks
- •Code Shortcuts
- •Adding Custom Tokens
- •The Server Explorer
- •Running SQL Queries
- •Visual Studio Windows
- •C# Interactive
- •Code Metrics Results
- •Maintainability Index
- •Cyclomatic Complexity
- •Class Coupling
- •Send Feedback
- •Personalizing Visual Studio
- •Adjust Line Spacing
- •Document Management Customizations
- •The Document Close Button
- •Modify the Dirty Indicator
- •Show Invisible Tabs in Italics in the Tab Drop-Down
- •Colorize Document Tabs
- •Tab Placement
- •Visual Studio Themes
- •Summary
- •Setting a Breakpoint
- •Step into Specific
- •Run to Click
- •Run to Cursor
- •Force Run to Cursor
- •Conditional Breakpoints and Actions
- •Temporary Breakpoints
- •Dependent Breakpoints
- •Dragging Breakpoints
- •Manage Breakpoints with Labels
- •Exporting Breakpoints
- •Using DataTips
- •Visualizing Complex Data Types
- •Bonus Tip
- •Using the Watch Window
- •The DebuggerDisplay Attribute
- •Evaluate Functions Without Side Effects
- •Format Specifiers
- •dynamic
- •hidden
- •results
- •Diagnostic Tools
- •CPU Usage
- •Memory Usage
- •The Events View
- •The Right Tool for the Right Project Type
- •Immediate Window
- •Attaching to a Running Process
- •Attach to a Remote Process
- •Remote Debugger Port Assignments
- •Remote Debugging
- •System Requirements
- •Download and Install Remote Tools
- •Running Remote Tools
- •Start Remote Debugging
- •Summary
- •Creating and Running Unit Tests
- •Create and Run a Test Playlist
- •Testing Timeouts
- •Using Live Unit Tests
- •Using IntelliTest to Generate Unit Tests
- •Focus IntelliTest Code Exploration
- •How to Measure Code Coverage in Visual Studio
- •Summary
- •Create a GitHub Account
- •Create and Clone a Repository
- •Create a Branch from Your Code
- •Creating and Handling Pull Requests
- •Multi-repo Support
- •Compare Branches
- •Check Out Commit
- •Line Staging
- •Summary
- •Index
Chapter 1 Getting to Know Visual Studio 2022
Summary
This chapter gave us a brief look around Visual Studio 2022. We explored the IDE and saw how to navigate code. Productivity features were discussed along with the
requirements for installing Visual Studio 2022. Lastly, we had a look at some of the other features included in Visual Studio such as its powerful search capabilities, Solution Filters, IntelliCode, whole line completions, and Live Share.
In the next chapter, we will be getting our hands dirty and start working with Visual Studio by looking at the various project templates included in Visual Studio 2022. We will briefly discuss MAUI, as well as how to create a MAUI project. We will also discuss NuGet and how to use this in Visual Studio as well as managing nmp packages. A particular favorite feature of mine is Visual Studio’s Code Snippets feature. We will see how to create and use code snippets to speed up your development. Visual Studio is also very customizable, and we will conclude Chapter 2 with looking at the personalization features in Visual Studio 2022.
64
CHAPTER 2
Working with Visual Studio 2022
If you have worked with previous versions of Visual Studio, you may find that Visual Studio 2022 does not break the mold. Visual Studio 2022 feels much the same as previous versions, and that’s a good thing.
While there are new features and enhancements in Visual Studio 2022, developers find it easy to work with from the start. If you are new to Visual Studio, a few topics deserve a closer look. In this chapter, we are going to look at the following:
•\ |
Visual Studio project types and when to use them |
•\ |
MAUI |
•\ |
Managing NuGet packages |
•\ |
Creating project templates |
•\ |
Creating and using code snippets |
•\ |
Using bookmarks and code shortcuts |
•\ |
The Server Explorer window |
•\ |
Visual Studio Windows |
This chapter is an extension of Chapter 1 in many respects. Things that didn’t make it into Chapter 1 are discussed in this chapter. I do believe, however, that these are essential to working with Visual Studio and benefit developers in their day-to- day coding.
65
© Dirk Strauss 2023
D. Strauss, Getting Started with Visual Studio 2022, https://doi.org/10.1007/978-1-4842-8922-8_2