.NET Core is an exciting new addition to the .NET ecosystem. It's a cross-platform, open-source, brand new implementation of .NET. In this course, you'll see how to quickly get up and running developing .NET Core apps.
With .NET Core, you can now run and develop apps on a wide variety of operating systems including macOS, Windows, and many Linux distros. Gone is the need for Windows. In this course, Getting Started with .NET Core for Windows Developers, you'll learn how to create a variety of .NET Core applications. First, you'll learn how to create cross-platform .NET Core console applications. Then, you'll get a look at the Universal Windows Platform (UWP), which is built on top of .NET Core, to build a single app that runs on any Windows 10 device. You'll see this app run as a Windows Desktop app, Mobile app, and on an XBox. Next, you will investigate creating reusable libraries that target .NET Standard. You will see how a single binary can be consumed by all .NET platforms and you'll refactor your apps to use this single binary in your .NET Core console app, UWP app, and even a Xamarin.Forms mobile cross-platform app. Finally, you'll learn how to easily package up this library as a NuGet package with the new dotnet CLI and how to write tests with the new .NET Core test model. The course will wrap up by taking a peek at the future of .NET Core. By the time you're finished with this course, you'll be comfortable building a .NET Core app.
Wes Higbee is passionate about helping companies achieve remarkable results with technology and software. He’s had extensive experience developing software and working with teams to improve how software is developed to meet business objectives. Wes launched Full City Tech to leverage his expertise to help companies delight customers.
Course Overview Hi, this is Wes Higbee. Welcome to my course, Getting Started with. NET Core for Windows Developers. In this course, we're going to learn about Microsoft's latest. NET platform called. NET Core. To understand this new platform we'll take a look at several different applications throughout this course. First, we'll start with a basic console application, a console app that fetches weather information and displays it. Next we'll build a similar application, but this time a UWP app, UWP being short for Universal Windows Platform. Both the console app and the UWP app are app models that run on top of. NET Core, so in the process we'll compare and contrast these two different applications to help you understand. NET Core. We'll then take a look at how we can share a code between these two apps. We'll share that code via a library project that we then package up with Nuget, we'll see how that's really easy to do with. NET Core. We'll see how to use that library with Xamarin. Forms, to understand how we can go cross platform onto mobile devices as well. We'll see how to test that shared library, and to understand the new testing model in. NET Core, and then we'll take a peek into the future to see what's coming. By the end of this course, you have a thorough understanding of. NET Core,. NET Standard, and how to build. NET apps that run on top of. NET Core. In this course, I assume that you are comfortable with #C, Visual Studio, and the existing. NET Framework.
Building Console Apps with .NET Core In this first module, we'll get our hands dirty; we'll grab a copy of. NET Core and we'll see how we can use it to build console applications, a console app that can fetch weather information, and we'll do this on Windows using Visual Studio primarily, but we'll also see the command line. The point of this module is to introduce you to. NET Core with a hands on example, and then use that example to explain the components of. NET Core.
Building UWP Apps with .NET Core In this module, we're going to turn our attention to another app model. In the last module we saw that both the. NET Framework and. NET Core contain a runtime, and then also contain some base class libraries. On top of these frameworks we can then write our own applications, and we saw a console app in the last module, but console apps are just one type of app model in the. NET Framework. So traditionally, we've had many, many different app models, for example, ASP. NET, WinForms, WPF, and even services, and of course we have many app models as well with. NET Core, for example, we saw the console app model already, that console app model could also be extended into a service with. NET Core, there's ASP. NET Core, and then in this module we'll take a look at UWP, which is a lot like WPF rewritten with. NET Core. In the past, developing Windows apps, especially when we got to Windows 8 and 8. 1, and the Windows Phone, it became really convoluted. If you wanted to target both Windows and Windows Phone, you had to have multiple projects to do that, it was really hard to manage all of this. Now with Windows 10 you don't have to do all of that. You can have one project now, built on top of the universal Windows Platform, it's one platform that works across all Windows 10 devices. Now, with UWP by default you target all these different device families, and if you want you can narrow it down to specific devices, for example just desktops or just mobile devices. The console app model on top of. NET Core was cross operating system, the easiest way to think about this UWP app model is that it's cross device in the Windows space. So let's get started looking at this new app model, and let's compare and contrast it to what we saw with the console app model, to learn even more about. NET Core.
Targeting the .NET Standard Library We have quite a bit of duplication built up between these two apps that we've built thus far, our console app and our UWP app. It would be nice to share some of that code, that's what we're going to turn our attention to in this module. If we want to share code we need a place to do that, so we need to create another library project to be able to bring over some of the common code. So I've got a question for you, how do you think we can go about creating a class library to share this code? One way is from Visual Studio, we can come in and Add a New Project, and then under. NET Core there's a Class Library choice. We'll be sharing code for OpenWeatherMap, so I'll call this OpenWeatherMapClient. This is a library we could actually share and use in many different applications. So you can imagine we might want to publish this as a NuGet package and use it for other purposes as well. Go ahead and click OK there. So that's one route, the other route would be to use dotnet new, and then -t Lib, and that'll create a new library project here in this folder, which at this point in time contains a Library. cs file and a project. json, much like what we have here in Visual Studio, we have our Class1. cs instead of Library. cs and then we have project. json. Now one interesting aspect about this class library, if you take a look at the frameworks section, instead of netcoreapp, we have netstandard1. 6. So this really isn't a. NET Core library, instead it's a library that targets NETStandard, and NETStandard happens to be something that. NET Core, as well as many other flavors of. NET, supports. So even though the Tooling here says. NET Core Class Library, it's really a. NET Standard class library, and I believe the Tooling's going to be updated soon to reflect that.
Sharing .NET Core Libraries as NuGet Packages At some point, you'll want to take the libraries that you create, like our OpenWeatherMapClient library, and use it for other projects. And you've probably done this in the past with NuGet, or you've probably at least consumed packages with NuGet. And if you've ever created them in the past you know it can be a little bit of work. You have to create a new spec file, that file oftentimes contains some duplicated information about your project, and then you take that new spec file and you run it through the NuGet command line tool, and spit out a NuGet package that you can share via nuget. org or some private NuGet feed. We're going to see in this module how easy it is to create a NuGet package for our library project, and we'll do this all from the command line. And then at the end of the module, we'll see how we can use our library inside of a Xamarin. Forms cross- platform mobile app, running on an Android device. I've pulled up the command prompt, and I've opened up the
The Future Before we wrap up this course, let's take a glimpse into the future and see what's coming with future versions of. NET Core, and also what's going to be happening in the. NET ecosystem. First, let's talk about the. NET Core command line tools. As you know right now, they're in preview at the time of recording, and currently we're on Preview 2. If you hop out to the GitHub site though, if you're curious about what's going on, you can come download the latest version of the preview tools, and eventually the RTM when that comes out and then future versions, by coming down to this table down below, picking your operating system, for example Windows x64 here, and then you can download an installer just for. NET Core, or you could pick. NET Core with the SDK. So from here I can grab the Preview 3 tooling, so it sounds like there will be a Preview 3 after Preview 2, before we get to RTM. This is the same installer that we got from. dotnet for the Preview 2 tooling at the beginning of this course. So I can run this, and then go ahead and install the latest version of the tools. Once that's done, I can then open a command prompt, and I can run the dotnet command specifying --info, and you'll see I now have the 1. 0. 0 tooling preview3 here, and once I have this on my computer then, I can take a look at the help that's available with Preview 3. For example that new command, and of course the first time you run this you'll download some packages as well to the package cache, okay, once that's done now, you should see the help for this new command provides some additional information, so we have valid values of C# and F# for the language, and then we have the valid types of projects here, and I'm sure this list is going to expand. For example, we now have the nunittest template, and we also have an MSBuild that wraps around, we also have an MSBuild template. And that's really interesting because that's where we're going with the future of the. NET Core command line tools. So actually, let's take a look at this in the next video, let's take a look at some of these templates and see what's different.