Book Image

ASP.NET Core 5 for Beginners

By : Andreas Helland, Vincent Maverick Durano, Jeffrey Chilberto, Ed Price
Book Image

ASP.NET Core 5 for Beginners

By: Andreas Helland, Vincent Maverick Durano, Jeffrey Chilberto, Ed Price

Overview of this book

ASP.NET Core 5 for Beginners is a comprehensive introduction for those who are new to the framework. This condensed guide takes a practical and engaging approach to cover everything that you need to know to start using ASP.NET Core for building cloud-ready, modern web applications. The book starts with a brief introduction to the ASP.NET Core framework and highlights the new features in its latest release, ASP.NET Core 5. It then covers the improvements in cross-platform support, the view engines that will help you to understand web development, and the new frontend technologies available with Blazor for building interactive web UIs. As you advance, you’ll learn the fundamentals of the different frameworks and capabilities that ship with ASP.NET Core. You'll also get to grips with securing web apps with identity implementation, unit testing, and the latest in containers and cloud-native to deploy them to AWS and Microsoft Azure. Throughout the book, you’ll find clear and concise code samples that illustrate each concept along with the strategies and techniques that will help to develop scalable and robust web apps. By the end of this book, you’ll have learned how to leverage ASP.NET Core 5 to build and deploy dynamic websites and services in a variety of real-world scenarios.
Table of Contents (19 chapters)
Section 1 – Crawling
Section 2 – Walking
Section 3 – Running

Exploring Visual Studio Code

Development in .NET has always been associated with Visual Studio, and the pattern has been that with new versions of Visual Studio comes new versions of .NET. Visual Studio is still a good companion to developers since it has been optimized over the years to provide you with everything needed, from writing code, improving upon it, and getting it into a production environment.

As a pure text editor, it doesn't shine equally strongly. In 2015, Microsoft decided to make this better by releasing Visual Studio (VS) Code. VS Code provides syntax highlighting, the side-by-side comparison of files, and other features a good editor should have. An integrated terminal is provided, so if you are writing a script, you do not need to switch applications to execute it. In addition, it supports extensions that enable you or other developers to extend the built-in functionality. For instance, you have probably opened a JSON file only to find it slightly off with line breaks and indentation – there is an extension called Prettify JSON that fixes that.

VS Code is not limited to editing various text-based files. It has built-in Git support, it can be configured with a debugger and connected to utilities for building your code, and a lot more. It's not limited to the .NET ecosystem either – it can be used for programming in JavaScript, Go, and a range of other languages. In fact, it is, at the time of writing, the most popular development tool on Stack Overflow across languages and platforms.

Navigating through VS Code is mostly done on the left-hand side of windows:

Figure 1.13 – Visual Studio Code navigation menu

Figure 1.13 – Visual Studio Code navigation menu

As you install extensions, more icons may appear in the list. (Not all extensions have an icon.)

In the lower-left corner, you will also find the option to add accounts (for instance, an Azure account if you are using extensions leveraging Azure). See Figure 1.14, for the Visual Studio accounts icon.

Figure 1.14 – Visual Studio accounts

Figure 1.14 – Visual Studio accounts

In the mid to right lower pane, you can enable some console windows:

Figure 1.15 – Visual Studio output tabs

Figure 1.15 – Visual Studio output tabs

Note that you may have to enable these through the menu (View | OUTPUT/DEBUG CONSOLE/TERMINAL/PROBLEMS) the first time. These give you easy access to the running output of the application, a terminal for running command-line operations, and so on. The relevance of these depends on what type of files you are editing – for something like a JSON file, the DEBUG CONSOLE tab will not bring any features.

For the context of this book, you will want to install the C# extension:

Figure 1.16 – C# Extension for Visual Studio Code

Figure 1.16 – C# extension for Visual Studio Code

This is an extension provided by Microsoft that enables VS Code to understand both C# code and related artifacts such as .NET project files.

If you work with Git repositories, you should also check out the third-party extension called GitLens, which has features useful for tracking changes in your code.

In this section, you've explored IDE environments and got familiar with the VS Code. Let's now learn how you can leverage the Windows terminal.