Section 1: Visual Studio IDE Productivity Essentials
This section provides the foundational knowledge all developers using Visual Studio should know in order to improve their productivity. Beyond the basics, some of the lesser-known features of the integrated development environment (IDE) are uncovered. Numerous hands-on exercises dive deep into how Visual Studio works behind the scenes.
This section has the following chapters:
- Chapter 1, Flavors of Visual Studio
- Chapter 2, Keyboard Shortcuts
- Chapter 3, IDE Tips and Tricks
- Chapter 4, Working with a Repository
- Chapter 5, Working with Snippets
- Chapter 6, Database Explorers
- Chapter 7, Compiling, Debugging, and Version Control
Chapter 1: Flavors of Visual Studio
Microsoft Visual Studio is an Integrated Development Environment (IDE) from Microsoft. Over its more than twenty-year history, it has been used by developers to develop all kinds of computer programs, web applications, web APIs, and mobile apps. A 2019 survey by Stack Overflow found Visual Studio and its cousin, Visual Studio Code (VS Code), to be two of the most popular development environments among all survey respondents (see https://insights.stackoverflow.com/survey/2019):
Figure 1.1 โ Stack Overflow 2019 survey
Note on Stack Overflow 2020 survey results
Although Stack Overflow's 2020 survey results were available at the time of writing, they did not seem to include the same specific question on development environments.
Visual Studio provides robust coding and debugging capabilities as well as extensive integration for deployment and source control needs. You can use it to program anything from a desktop business application, to a web site, mobile application, or Unity game.
If you are new to programming or .NET development, it is important to understand that there are several options to consider before starting. This chapter's primary focus is to cover some key factors you should consider when deciding which product "flavor" of Visual Studio is right for you, including the following:
- Primary operating system (Windows, macOS, or Linux)
- Target framework (.NET full framework, .NET Core)
- Team size and budget
- Application type (Windows, web, mobile, server, or console)
- Cross-platform portability requirements
- Chosen programming language (such as C#, VB, Python, Ruby, or NodeJS)
The reason why we must examine the aforementioned points in detail is because Microsoft has combined what are actually multiple, separate, products under a single marketing umbrella. This can make choosing between these products confusing and so we will take a moment to clearly identify each version, differentiate their features, and provide some guidance on which version may be best for your purposes.
Technical requirements
The code for this book is available on GitHub at: https://github.com/PacktPublishing/Visual-Studio-2019-Tricks-and-Techniques/tree/main/.
Please check the following link for CiA videos: http://bit.ly/3oxE5QM.
Quick reference cheat sheet
With so many options, how does a developer know which version to use? The following is a list of simplified suggestions to help you choose a particular flavor:
- If you are using a PC and are brand new to software development, start with VS 2019 Community.
- If you are using a PC as an experienced developer, or have a well-funded company footing the bill, consider the VS 2019 Professional or VS 2019 Enterprise editions.
- If you're primarily a web developer planning to use NodeJS and TypeScript, try VS Code.
- If you're developing cross-platform iOS/Android mobile apps, consider using VS for Mac.
Have you already decided on which version to use?
If you have already figured out which version of Visual Studio is right for you, then feel free to skip this chapter's content. Alternatively, if you are an experienced developer, skim this material looking for new tidbits, such as GitHub Codespaces.
For those readers that need more information to decide, let's begin digging into the details of the most long-lived product flavor, Visual Studio for Windows.
Visual Studio 2019 (Windows)
Let's start with Visual Studio 2019 (VS 2019), a Windows-based IDE (pronounced AYE-dee-ee). Some people will refer to this product as the full version. This version only runs on Windows (not cross-platform), but it does support both .NET "full framework" and .NET Core (cross-platform) project targets. Something all versions of Visual Studio do exceptionally well is work with diverse programming languages (including C, C++, Visual Basic. NET, C#, F#, JavaScript, TypeScript, Python, Ruby, and Node.js).
Different tiers of features are offered, depending on your needs and budget. Current versions of VS 2019 include a free Community edition as well as paid Professional, Enterprise, and Test Professional versions. The Community and Professional editions are nearly identical when it comes to operational features and, for most development tasks, any version of Visual Studio will work.
The Community version is depicted in the screenshot that follows and you will find virtually no difference between its appearance and that of the other versions:
Figure 1.2 โ VS 2019 Community โ Windows
Even with multiple options, choosing a Visual Studio edition is much easier today than in the past. Previously, certain project types could only be loaded in one edition or another, and many add-ins would not run in certain editions. Complex licensing issues compounded these problems, making it more difficult to choose.
Today, even the free Community edition is a powerful environment with much to offer. Many of the popular features, such as peeking at definitions, multi-targeting of release targets, and refactoring are supported in all editions.
More succinctly, the major versions of VS 2019 are as follows:
- Community โ Free for students, open source contributors, and individuals
- Professional โ The best choice for small teams
- Test Professional โ An option for dedicated Quality Assurance (QA) roles
- Enterprise โ Offers extra features (mentioned later in this chapter) and works well for teams of any size
In the past, the Community version, originally labeled "Express," was a very limited version that allowed only basic application development but would not allow for particular target types (such as Visual Studio plugins), and would also not allow a number of plugins to run. While some of these limitations seemed minor, they were enough to create negative perceptions of the platform among some developers and sour development community sentiment on the Community version. In recent years, Microsoft has removed many of the original restrictions and enabled so much functionality in this version that the experience is now very similar to the Professional version.
Traditionally, the Professional version was the lowest tier version for "true" developers. Because of the limitations of other versions, this was the only way to do "actual" development. This version tier is (and always has been) a full-featured IDE with all the bells and whistles you would expect in a professional development tool.
A key difference is that VS 2019 Community is free, while the Professional version retails for about $1,199 for the first year's subscription and $799 annually for renewal thereafter. However, there are license restrictions that limit use of Visual Studio Community to teams of less than five developers. Also, it cannot be used by commercial organizations with over $1 million US dollars in annual revenue.
For those whose focus is purely QA, and not development, Test Professional is another option to consider. It provides an integrated testing toolset for QA ...