How to install .NET 5

This release is a big deal.  Basically, all the different versions of .NET like shown in the following bullet list are merged into this one version called .NET 5.

  • .NET Framework
  • .NET Core
  • .NET Standard

From .NET 5 all projects can be run cross platform and cross verticals like WPF and ASP.NET.

Here are some detailed articles about .NET 5 which I recommend you read.

To install and use .NET 5, like most other versions, it is dependent on the version of Visual Studio you are running.  I installed the ASP.NET Core Runtime Hosting Bundle but since I was running version 16.7.3, as seen in Figure 1, I didn’t see any way to choose .NET 5.

image

Figure 1, install Visual Studio to use .NET 5

After downloading and installing the supported Visual Studio version, 16.8 (currently in preview), all worked as expected.  Download and install preview 3 of Visual Studio 2019 version 16.8 here.  See Figure 2.

image

Figure 2, install Visual Studio to use .NET 5

I installed the ASP.NET and web development, Azure development, Python development, .NET Core cross-platform development, Visual Studio Codespaces, Data storage and processing and .NET desktop development workloads, as seen in Figure 3.

image

Figure 3, install Visual Studio to use .NET 5 with some additional workloads

In the properties window for the Console Application I can see .NET 5, as shown in Figure 4.

image

Figure 4, .NET 5 in Visual Studio how to

I only found .NET 5 as a Target framework, see Figure 4 again, when I chose either Console App (.NET Core) or ASP.NET Core Web Application.  .NET 5 was not existing when I selected ASP.NET Web Application (.NET Framework).  The last version of the .NET Framework is 4.8 and, as I have read, all future functional updates will be made only to .NET 5.

One thing that got me some time ago was thinking about which bit version of the runtime do I need to download, x64 or x32.  Basically, it means that if you know the target machine bit-ness and you know your program will only be run on that platform, then you can install and target that platform directly.  YOu can see this in Figure 5. 

image

Figure 5, .NET 5 how to choose x64 or x32

I was happy to see the Hosting Bundle which made my decision much easier.

I think .NET 5 is a game changer and a great simplifier for the new applications that will be built using this stack from now on.  A beginning developer may not know the significance of choosing a stack and version of development tools and stacks.  However, this, being one of the first decisions needing to be made is a very important one, indeed.

Lastly, just to prove to myself that I have it all configured I used one of the new features in C# 9 which is called Top-level statements.  See Figure 6.

image

Figure 6, .NET 5, what new in C# 9

Which is an alternative to the following code.  That code does contain a lot of definitions and brackets which may not be necessary if you are writing a simple program.  Simplicity and clarity are very important and I like this new feature.

using System;
namespace dotnet5
{
     class Program
     {
         static void Main(string[] args)
         {
             Console.WriteLine("Hello World! Introducing .NET 5");
             Console.ReadLine();
         }
     }
}