In this section the instructor introduces .NET Core and why it was created.
- [Instructor] Now that you have everything installed that you need for this course, let's dive into .NET Core itself. So one of the questions I get asked many times is, "Why .NET Core?" After all, there's millions of developers using ASP.NET MVC and Web API. And did they need to, they being Microsoft, really need to create a whole nother framework? Well, one of the problems with the current ecosystem is that there are too many vertical frameworks.
So we've got desktop development. We've got Phone, which is Xamarin now, but was based on Mono. Silverlight, granted, Silverlight has gone away, but it had a little different flavor of XAML than WPF. And then even within the web development space, ASP.NET MVC and Web API had some glaring differences but also some very subtle differences between 'em. And customers were asking for a single unified platform.
There were also many customers that were asking for cross-platform support. Now, .NET Core started off as Project K, and it was, with discussions of the Windows Nano team, trying to get a version of .NET that would run on something other than full-blown Windows. Now, you might ask why that matters. Well, first and foremost, it can reduce operating costs. It is cheaper to maintain a Linux or Unix-based server than it is a Windows server, and anybody who has hosted their own website can attest to that.
And there's also the goal of Microsoft to expand a developer base. There are millions of Java developers out there. And the question is, do they really want to develop in Java, or is it because they want to run on Linux? Well, now you have choices. Regardless of how you want to deploy it, you can use the .NET stack. I'd be remiss if I didn't call out the elephant in the room, and that is the original name of .NET Core, which was ASP.NET 5.
And this caused all kinds of confusions in the .NET community and, of course, outside the .NET community. Microsoft had a very specific goal, and they didn't want to lose the ASP.NET brand. They had spent years and lots of money and time developing that brand, and it's a very powerful brand. But the problem with naming it ASP.NET 5 is many people thought it was the next version of the .NET Framework because we were currently at 4.6 when it got released, so 4.6 is less than five, 5 must be the next full version.
Fortunately, for all of us, Microsoft rebranded this new cross-platform version of .NET as .NET Core. And it's three main pieces, .NET Core itself, the ASP.NET Core framework, and Entity Framework Core. So let's talk about the composition of .NET Core. And when we refer to .NET Core, we're really talking about two specific pieces. And that is the runtime, or the CoreCLR, and that has garbage collection, the jitter, the base .NET types.
This is the layer that sits on top of whichever operating system you're deploying to or developing on and provides the equivalent of the virtual machine that you would find perhaps in Java, but also in .NET. Then there's the framework libraries, and that the CoreFX. And that's mostly platform agnostic. There are some platform-specific items in there, which is why you'll have a specific install for the CoreFX as well, but normally we just refer to the .NET Core framework as both of those put together and never really consider them separate pieces.
Then sitting on top of that is the application host and command-line interface. You've already seen both of these in action. The application host is dotnet.exe. That's how we're going to run applications in the .NET Core world. And the command-line interface we used to build the migrations as well as run the application from the command prompt when we did dotnet run. Next up, we have the development frameworks, and what we're talking about today in this course is ASP.NET Core and Entity Framework Core.
And then on top of all that, you have your custom applications. One difference in .NET Core from previous versions of .NET is there are only two types of projects. There are console applications or class libraries. So even if you're making an MVC-type web application, it is still just a console app at its root. We talked about the cross-platform deployment, and here are just some of the examples.
There's, of course, many, many more. But you could do the traditional Windows or Azure, using IIS. You can also self-host in Windows or Azure app service outside of IIS. You can run on Linux, for example, using Apache or NGINX. And you can also run on Windows and Linux using Docker or other containers as well.
- Running and debugging ASP.NET Core applications
- Pros and cons of migrating existing applications to ASP.NET Core.
- Built-in dependency injection
- Environment awareness and app configuration
- Web host configuration and SSL
- View components invoked as tag helpers
- Configuration and logging
- Using Razor Pages